diff options
Diffstat (limited to 'include/asm-arm/arch-s3c2410/io.h')
| -rw-r--r-- | include/asm-arm/arch-s3c2410/io.h | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/include/asm-arm/arch-s3c2410/io.h b/include/asm-arm/arch-s3c2410/io.h index 418233a7ee6f..16fbc8afffd9 100644 --- a/include/asm-arm/arch-s3c2410/io.h +++ b/include/asm-arm/arch-s3c2410/io.h | |||
| @@ -9,12 +9,14 @@ | |||
| 9 | * 06-Dec-1997 RMK Created. | 9 | * 06-Dec-1997 RMK Created. |
| 10 | * 02-Sep-2003 BJD Modified for S3C2410 | 10 | * 02-Sep-2003 BJD Modified for S3C2410 |
| 11 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | 11 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA |
| 12 | * | 12 | * 13-Oct-2005 BJD Fixed problems with LDRH/STRH offset range |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #ifndef __ASM_ARM_ARCH_IO_H | 15 | #ifndef __ASM_ARM_ARCH_IO_H |
| 16 | #define __ASM_ARM_ARCH_IO_H | 16 | #define __ASM_ARM_ARCH_IO_H |
| 17 | 17 | ||
| 18 | #include <asm/hardware.h> | ||
| 19 | |||
| 18 | #define IO_SPACE_LIMIT 0xffffffff | 20 | #define IO_SPACE_LIMIT 0xffffffff |
| 19 | 21 | ||
| 20 | /* | 22 | /* |
| @@ -97,7 +99,7 @@ DECLARE_IO(int,l,"") | |||
| 97 | else \ | 99 | else \ |
| 98 | __asm__ __volatile__( \ | 100 | __asm__ __volatile__( \ |
| 99 | "strb %0, [%1, #0] @ outbc" \ | 101 | "strb %0, [%1, #0] @ outbc" \ |
| 100 | : : "r" (value), "r" ((port))); \ | 102 | : : "r" (value), "r" ((port))); \ |
| 101 | }) | 103 | }) |
| 102 | 104 | ||
| 103 | #define __inbc(port) \ | 105 | #define __inbc(port) \ |
| @@ -110,35 +112,61 @@ DECLARE_IO(int,l,"") | |||
| 110 | else \ | 112 | else \ |
| 111 | __asm__ __volatile__( \ | 113 | __asm__ __volatile__( \ |
| 112 | "ldrb %0, [%1, #0] @ inbc" \ | 114 | "ldrb %0, [%1, #0] @ inbc" \ |
| 113 | : "=r" (result) : "r" ((port))); \ | 115 | : "=r" (result) : "r" ((port))); \ |
| 114 | result; \ | 116 | result; \ |
| 115 | }) | 117 | }) |
| 116 | 118 | ||
| 117 | #define __outwc(value,port) \ | 119 | #define __outwc(value,port) \ |
| 118 | ({ \ | 120 | ({ \ |
| 119 | unsigned long v = value; \ | 121 | unsigned long v = value; \ |
| 120 | if (__PORT_PCIO((port))) \ | 122 | if (__PORT_PCIO((port))) { \ |
| 121 | __asm__ __volatile__( \ | 123 | if ((port) < 256 && (port) > -256) \ |
| 122 | "strh %0, [%1, %2] @ outwc" \ | 124 | __asm__ __volatile__( \ |
| 123 | : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ | 125 | "strh %0, [%1, %2] @ outwc" \ |
| 124 | else \ | 126 | : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ |
| 127 | else if ((port) > 0) \ | ||
| 128 | __asm__ __volatile__( \ | ||
| 129 | "strh %0, [%1, %2] @ outwc" \ | ||
| 130 | : : "r" (v), \ | ||
| 131 | "r" (PCIO_BASE + ((port) & ~0xff)), \ | ||
| 132 | "Jr" (((port) & 0xff))); \ | ||
| 133 | else \ | ||
| 134 | __asm__ __volatile__( \ | ||
| 135 | "strh %0, [%1, #0] @ outwc" \ | ||
| 136 | : : "r" (v), \ | ||
| 137 | "r" (PCIO_BASE + (port))); \ | ||
| 138 | } else \ | ||
| 125 | __asm__ __volatile__( \ | 139 | __asm__ __volatile__( \ |
| 126 | "strh %0, [%1, #0] @ outwc" \ | 140 | "strh %0, [%1, #0] @ outwc" \ |
| 127 | : : "r" (v), "r" ((port))); \ | 141 | : : "r" (v), "r" ((port))); \ |
| 128 | }) | 142 | }) |
| 129 | 143 | ||
| 130 | #define __inwc(port) \ | 144 | #define __inwc(port) \ |
| 131 | ({ \ | 145 | ({ \ |
| 132 | unsigned short result; \ | 146 | unsigned short result; \ |
| 133 | if (__PORT_PCIO((port))) \ | 147 | if (__PORT_PCIO((port))) { \ |
| 134 | __asm__ __volatile__( \ | 148 | if ((port) < 256 && (port) > -256 ) \ |
| 135 | "ldrh %0, [%1, %2] @ inwc" \ | 149 | __asm__ __volatile__( \ |
| 136 | : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \ | 150 | "ldrh %0, [%1, %2] @ inwc" \ |
| 137 | else \ | 151 | : "=r" (result) \ |
| 152 | : "r" (PCIO_BASE), \ | ||
| 153 | "Jr" ((port))); \ | ||
| 154 | else if ((port) > 0) \ | ||
| 155 | __asm__ __volatile__( \ | ||
| 156 | "ldrh %0, [%1, %2] @ inwc" \ | ||
| 157 | : "=r" (result) \ | ||
| 158 | : "r" (PCIO_BASE + ((port) & ~0xff)), \ | ||
| 159 | "Jr" (((port) & 0xff))); \ | ||
| 160 | else \ | ||
| 161 | __asm__ __volatile__( \ | ||
| 162 | "ldrh %0, [%1, #0] @ inwc" \ | ||
| 163 | : "=r" (result) \ | ||
| 164 | : "r" (PCIO_BASE + ((port)))); \ | ||
| 165 | } else \ | ||
| 138 | __asm__ __volatile__( \ | 166 | __asm__ __volatile__( \ |
| 139 | "ldrh %0, [%1, #0] @ inwc" \ | 167 | "ldrh %0, [%1, #0] @ inwc" \ |
| 140 | : "=r" (result) : "r" ((port))); \ | 168 | : "=r" (result) : "r" ((port))); \ |
| 141 | result; \ | 169 | result; \ |
| 142 | }) | 170 | }) |
| 143 | 171 | ||
| 144 | #define __outlc(value,port) \ | 172 | #define __outlc(value,port) \ |
