* [PATCH 00/10] Clean up some io.h and associated code
@ 2011-08-17 7:51 Russell King - ARM Linux
2011-08-17 7:51 ` [PATCH 01/10] ARM: io: s3c2410: remove ioaddr() Russell King - ARM Linux
` (10 more replies)
0 siblings, 11 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:51 UTC (permalink / raw)
To: linux-arm-kernel
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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/10] ARM: io: s3c2410: remove ioaddr()
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
@ 2011-08-17 7:51 ` Russell King - ARM Linux
2011-08-17 7:51 ` [PATCH 02/10] ARM: io: RiscPC: define io addresses relative to IO_BASE Russell King - ARM Linux
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:51 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-s3c2410/include/mach/io.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-s3c2410/include/mach/io.h b/arch/arm/mach-s3c2410/include/mach/io.h
index 9813dbf..118749f 100644
--- a/arch/arm/mach-s3c2410/include/mach/io.h
+++ b/arch/arm/mach-s3c2410/include/mach/io.h
@@ -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)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/10] ARM: io: RiscPC: define io addresses relative to IO_BASE
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
2011-08-17 7:51 ` [PATCH 01/10] ARM: io: s3c2410: remove ioaddr() Russell King - ARM Linux
@ 2011-08-17 7:51 ` Russell King - ARM Linux
2011-08-17 7:52 ` [PATCH 03/10] ARM: io: ecard: move ioaddr() inside __ecard_address Russell King - ARM Linux
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:51 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-rpc/include/mach/hardware.h | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h
index dde6b3c..822b810 100644
--- a/arch/arm/mach-rpc/include/mach/hardware.h
+++ b/arch/arm/mach-rpc/include/mach/hardware.h
@@ -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)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/10] ARM: io: ecard: move ioaddr() inside __ecard_address
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
2011-08-17 7:51 ` [PATCH 01/10] ARM: io: s3c2410: remove ioaddr() Russell King - ARM Linux
2011-08-17 7:51 ` [PATCH 02/10] ARM: io: RiscPC: define io addresses relative to IO_BASE Russell King - ARM Linux
@ 2011-08-17 7:52 ` Russell King - ARM Linux
2011-08-17 7:52 ` [PATCH 04/10] ARM: io: ecard: remove ioaddr() from ecard.c Russell King - ARM Linux
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:52 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/include/asm/ecard.h | 1 -
arch/arm/kernel/ecard.c | 11 ++++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/ecard.h b/arch/arm/include/asm/ecard.h
index 29f2610..eaea146 100644
--- a/arch/arm/include/asm/ecard.h
+++ b/arch/arm/include/asm/ecard.h
@@ -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;
};
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index d165001..920f1a3 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -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;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/10] ARM: io: ecard: remove ioaddr() from ecard.c
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (2 preceding siblings ...)
2011-08-17 7:52 ` [PATCH 03/10] ARM: io: ecard: move ioaddr() inside __ecard_address Russell King - ARM Linux
@ 2011-08-17 7:52 ` Russell King - ARM Linux
2011-08-17 7:52 ` [PATCH 05/10] ARM: io: RiscPC: make EASI_BASE a void iomem pointer Russell King - ARM Linux
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:52 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
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(-)
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index 920f1a3..3e84f66 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -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();
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h
index 822b810..4177766 100644
--- a/arch/arm/mach-rpc/include/mach/hardware.h
+++ b/arch/arm/mach-rpc/include/mach/hardware.h
@@ -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
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h
index 20da7f4..dd706ff 100644
--- a/arch/arm/mach-rpc/include/mach/io.h
+++ b/arch/arm/mach-rpc/include/mach/io.h
@@ -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)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/10] ARM: io: RiscPC: make EASI_BASE a void iomem pointer
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (3 preceding siblings ...)
2011-08-17 7:52 ` [PATCH 04/10] ARM: io: ecard: remove ioaddr() from ecard.c Russell King - ARM Linux
@ 2011-08-17 7:52 ` Russell King - ARM Linux
2011-08-17 7:53 ` [PATCH 06/10] ARM: io: RiscPC: eliminate private inb() et.al. definitions Russell King - ARM Linux
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:52 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
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(-)
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index 3e84f66..4dd0eda 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -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));
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h
index 4177766..050d63c 100644
--- a/arch/arm/mach-rpc/include/mach/hardware.h
+++ b/arch/arm/mach-rpc/include/mach/hardware.h
@@ -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)
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index 580b3c7..1e0e60d 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -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
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/10] ARM: io: RiscPC: eliminate private inb() et.al. definitions
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (4 preceding siblings ...)
2011-08-17 7:52 ` [PATCH 05/10] ARM: io: RiscPC: make EASI_BASE a void iomem pointer Russell King - ARM Linux
@ 2011-08-17 7:53 ` Russell King - ARM Linux
2011-08-17 7:53 ` [PATCH 07/10] ARM: io: add a default IO_SPACE_LIMIT definition Russell King - ARM Linux
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:53 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-rpc/include/mach/io.h | 190 ++---------------------------------
1 files changed, 8 insertions(+), 182 deletions(-)
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h
index dd706ff..695f4ed 100644
--- a/arch/arm/mach-rpc/include/mach/io.h
+++ b/arch/arm/mach-rpc/include/mach/io.h
@@ -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.
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/10] ARM: io: add a default IO_SPACE_LIMIT definition
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (5 preceding siblings ...)
2011-08-17 7:53 ` [PATCH 06/10] ARM: io: RiscPC: eliminate private inb() et.al. definitions Russell King - ARM Linux
@ 2011-08-17 7:53 ` Russell King - ARM Linux
2011-08-17 7:53 ` [PATCH 08/10] ARM: io: remove IO_SPACE_LIMIT from platforms with ISA/PCI and 64K window Russell King - ARM Linux
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:53 UTC (permalink / raw)
To: linux-arm-kernel
Add a default IO_SPACE_LIMIT definition. Explain the chosen value and
suggest why platforms would want to make it larger.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/include/asm/io.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605d..ffb089d 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -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
* -------------------------
*
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/10] ARM: io: remove IO_SPACE_LIMIT from platforms with ISA/PCI and 64K window
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (6 preceding siblings ...)
2011-08-17 7:53 ` [PATCH 07/10] ARM: io: add a default IO_SPACE_LIMIT definition Russell King - ARM Linux
@ 2011-08-17 7:53 ` Russell King - ARM Linux
2011-08-17 7:54 ` [PATCH 09/10] ARM: io: remove IO_SPACE_LIMIT from platforms without PCI/ISA Russell King - ARM Linux
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:53 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-ebsa110/include/mach/io.h | 2 --
| 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(-)
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h
index f68daa63..44679db 100644
--- a/arch/arm/mach-ebsa110/include/mach/io.h
+++ b/arch/arm/mach-ebsa110/include/mach/io.h
@@ -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);
--git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
index 32e4cc3..15a7039 100644
--- a/arch/arm/mach-footbridge/include/mach/io.h
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -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
*/
diff --git a/arch/arm/mach-integrator/include/mach/io.h b/arch/arm/mach-integrator/include/mach/io.h
index f21bb54..37beed3 100644
--- a/arch/arm/mach-integrator/include/mach/io.h
+++ b/arch/arm/mach-integrator/include/mach/io.h
@@ -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
*/
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 57b5410..ffb9d6a 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -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);
diff --git a/arch/arm/mach-vt8500/include/mach/io.h b/arch/arm/mach-vt8500/include/mach/io.h
index 9077239..46181ee 100644
--- a/arch/arm/mach-vt8500/include/mach/io.h
+++ b/arch/arm/mach-vt8500/include/mach/io.h
@@ -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)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/10] ARM: io: remove IO_SPACE_LIMIT from platforms without PCI/ISA
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (7 preceding siblings ...)
2011-08-17 7:53 ` [PATCH 08/10] ARM: io: remove IO_SPACE_LIMIT from platforms with ISA/PCI and 64K window Russell King - ARM Linux
@ 2011-08-17 7:54 ` Russell King - ARM Linux
2011-08-17 7:54 ` [PATCH 10/10] ARM: io: remove IO_SPACE_LIMIT from SA11x0 Russell King - ARM Linux
2011-08-18 15:14 ` [PATCH 00/10] Clean up some io.h and associated code Arnd Bergmann
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:54 UTC (permalink / raw)
To: linux-arm-kernel
Nothing should be using PCI/ISA IO on these platforms, so their
IO_SPACE_LIMIT definitions are irrelevent.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-vexpress/include/mach/io.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-vexpress/include/mach/io.h b/arch/arm/mach-vexpress/include/mach/io.h
index 748bb52..13522d8 100644
--- a/arch/arm/mach-vexpress/include/mach/io.h
+++ b/arch/arm/mach-vexpress/include/mach/io.h
@@ -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)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/10] ARM: io: remove IO_SPACE_LIMIT from SA11x0
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (8 preceding siblings ...)
2011-08-17 7:54 ` [PATCH 09/10] ARM: io: remove IO_SPACE_LIMIT from platforms without PCI/ISA Russell King - ARM Linux
@ 2011-08-17 7:54 ` Russell King - ARM Linux
2011-08-18 15:14 ` [PATCH 00/10] Clean up some io.h and associated code Arnd Bergmann
10 siblings, 0 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-17 7:54 UTC (permalink / raw)
To: linux-arm-kernel
SA11x0 only uses IO_SPACE_LIMIT for SOC_COMMON, so we can use the
default value in asm/io.h.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/include/mach/io.h | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h
index d8b43f3..dfc27ff 100644
--- a/arch/arm/mach-sa1100/include/mach/io.h
+++ b/arch/arm/mach-sa1100/include/mach/io.h
@@ -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)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 00/10] Clean up some io.h and associated code
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
` (9 preceding siblings ...)
2011-08-17 7:54 ` [PATCH 10/10] ARM: io: remove IO_SPACE_LIMIT from SA11x0 Russell King - ARM Linux
@ 2011-08-18 15:14 ` Arnd Bergmann
2011-08-21 8:37 ` Russell King - ARM Linux
10 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2011-08-18 15:14 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday 17 August 2011, Russell King - ARM Linux wrote:
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 00/10] Clean up some io.h and associated code
2011-08-18 15:14 ` [PATCH 00/10] Clean up some io.h and associated code Arnd Bergmann
@ 2011-08-21 8:37 ` Russell King - ARM Linux
2011-08-21 13:21 ` Arnd Bergmann
0 siblings, 1 reply; 14+ messages in thread
From: Russell King - ARM Linux @ 2011-08-21 8:37 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Aug 18, 2011 at 05:14:47PM +0200, Arnd Bergmann wrote:
> On Wednesday 17 August 2011, Russell King - ARM Linux wrote:
> > 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.
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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 00/10] Clean up some io.h and associated code
2011-08-21 8:37 ` Russell King - ARM Linux
@ 2011-08-21 13:21 ` Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2011-08-21 13:21 UTC (permalink / raw)
To: linux-arm-kernel
On Sunday 21 August 2011 09:37:44 Russell King - ARM Linux wrote:
> > 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
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-08-21 13:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17 7:51 [PATCH 00/10] Clean up some io.h and associated code Russell King - ARM Linux
2011-08-17 7:51 ` [PATCH 01/10] ARM: io: s3c2410: remove ioaddr() Russell King - ARM Linux
2011-08-17 7:51 ` [PATCH 02/10] ARM: io: RiscPC: define io addresses relative to IO_BASE Russell King - ARM Linux
2011-08-17 7:52 ` [PATCH 03/10] ARM: io: ecard: move ioaddr() inside __ecard_address Russell King - ARM Linux
2011-08-17 7:52 ` [PATCH 04/10] ARM: io: ecard: remove ioaddr() from ecard.c Russell King - ARM Linux
2011-08-17 7:52 ` [PATCH 05/10] ARM: io: RiscPC: make EASI_BASE a void iomem pointer Russell King - ARM Linux
2011-08-17 7:53 ` [PATCH 06/10] ARM: io: RiscPC: eliminate private inb() et.al. definitions Russell King - ARM Linux
2011-08-17 7:53 ` [PATCH 07/10] ARM: io: add a default IO_SPACE_LIMIT definition Russell King - ARM Linux
2011-08-17 7:53 ` [PATCH 08/10] ARM: io: remove IO_SPACE_LIMIT from platforms with ISA/PCI and 64K window Russell King - ARM Linux
2011-08-17 7:54 ` [PATCH 09/10] ARM: io: remove IO_SPACE_LIMIT from platforms without PCI/ISA Russell King - ARM Linux
2011-08-17 7:54 ` [PATCH 10/10] ARM: io: remove IO_SPACE_LIMIT from SA11x0 Russell King - ARM Linux
2011-08-18 15:14 ` [PATCH 00/10] Clean up some io.h and associated code Arnd Bergmann
2011-08-21 8:37 ` Russell King - ARM Linux
2011-08-21 13:21 ` Arnd Bergmann
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).