hugetlb: introduce generic version of hugetlb_free_pgd_range
[linux/fpc-iii.git] / arch / sh / boards / mach-microdev / io.c
blobacdafb0c6404a153cc482e46c0a17287f15ea26e
1 /*
2 * linux/arch/sh/boards/superh/microdev/io.c
4 * Copyright (C) 2003 Sean McGoogan (Sean.McGoogan@superh.com)
5 * Copyright (C) 2003, 2004 SuperH, Inc.
6 * Copyright (C) 2004 Paul Mundt
8 * SuperH SH4-202 MicroDev board support.
10 * May be copied or modified under the terms of the GNU General Public
11 * License. See linux/COPYING for more information.
14 #include <linux/init.h>
15 #include <linux/pci.h>
16 #include <linux/wait.h>
17 #include <asm/io.h>
18 #include <mach/microdev.h>
21 * we need to have a 'safe' address to re-direct all I/O requests
22 * that we do not explicitly wish to handle. This safe address
23 * must have the following properies:
25 * * writes are ignored (no exception)
26 * * reads are benign (no side-effects)
27 * * accesses of width 1, 2 and 4-bytes are all valid.
29 * The Processor Version Register (PVR) has these properties.
31 #define PVR 0xff000030 /* Processor Version Register */
34 #define IO_IDE2_BASE 0x170ul /* I/O base for SMSC FDC37C93xAPM IDE #2 */
35 #define IO_IDE1_BASE 0x1f0ul /* I/O base for SMSC FDC37C93xAPM IDE #1 */
36 #define IO_ISP1161_BASE 0x290ul /* I/O port for Philips ISP1161x USB chip */
37 #define IO_SERIAL2_BASE 0x2f8ul /* I/O base for SMSC FDC37C93xAPM Serial #2 */
38 #define IO_LAN91C111_BASE 0x300ul /* I/O base for SMSC LAN91C111 Ethernet chip */
39 #define IO_IDE2_MISC 0x376ul /* I/O misc for SMSC FDC37C93xAPM IDE #2 */
40 #define IO_SUPERIO_BASE 0x3f0ul /* I/O base for SMSC FDC37C93xAPM SuperIO chip */
41 #define IO_IDE1_MISC 0x3f6ul /* I/O misc for SMSC FDC37C93xAPM IDE #1 */
42 #define IO_SERIAL1_BASE 0x3f8ul /* I/O base for SMSC FDC37C93xAPM Serial #1 */
44 #define IO_ISP1161_EXTENT 0x04ul /* I/O extent for Philips ISP1161x USB chip */
45 #define IO_LAN91C111_EXTENT 0x10ul /* I/O extent for SMSC LAN91C111 Ethernet chip */
46 #define IO_SUPERIO_EXTENT 0x02ul /* I/O extent for SMSC FDC37C93xAPM SuperIO chip */
47 #define IO_IDE_EXTENT 0x08ul /* I/O extent for IDE Task Register set */
48 #define IO_SERIAL_EXTENT 0x10ul
50 #define IO_LAN91C111_PHYS 0xa7500000ul /* Physical address of SMSC LAN91C111 Ethernet chip */
51 #define IO_ISP1161_PHYS 0xa7700000ul /* Physical address of Philips ISP1161x USB chip */
52 #define IO_SUPERIO_PHYS 0xa7800000ul /* Physical address of SMSC FDC37C93xAPM SuperIO chip */
55 * map I/O ports to memory-mapped addresses
57 void __iomem *microdev_ioport_map(unsigned long offset, unsigned int len)
59 unsigned long result;
61 if ((offset >= IO_LAN91C111_BASE) &&
62 (offset < IO_LAN91C111_BASE + IO_LAN91C111_EXTENT)) {
64 * SMSC LAN91C111 Ethernet chip
66 result = IO_LAN91C111_PHYS + offset - IO_LAN91C111_BASE;
67 } else if ((offset >= IO_SUPERIO_BASE) &&
68 (offset < IO_SUPERIO_BASE + IO_SUPERIO_EXTENT)) {
70 * SMSC FDC37C93xAPM SuperIO chip
72 * Configuration Registers
74 result = IO_SUPERIO_PHYS + (offset << 1);
75 } else if (((offset >= IO_IDE1_BASE) &&
76 (offset < IO_IDE1_BASE + IO_IDE_EXTENT)) ||
77 (offset == IO_IDE1_MISC)) {
79 * SMSC FDC37C93xAPM SuperIO chip
81 * IDE #1
83 result = IO_SUPERIO_PHYS + (offset << 1);
84 } else if (((offset >= IO_IDE2_BASE) &&
85 (offset < IO_IDE2_BASE + IO_IDE_EXTENT)) ||
86 (offset == IO_IDE2_MISC)) {
88 * SMSC FDC37C93xAPM SuperIO chip
90 * IDE #2
92 result = IO_SUPERIO_PHYS + (offset << 1);
93 } else if ((offset >= IO_SERIAL1_BASE) &&
94 (offset < IO_SERIAL1_BASE + IO_SERIAL_EXTENT)) {
96 * SMSC FDC37C93xAPM SuperIO chip
98 * Serial #1
100 result = IO_SUPERIO_PHYS + (offset << 1);
101 } else if ((offset >= IO_SERIAL2_BASE) &&
102 (offset < IO_SERIAL2_BASE + IO_SERIAL_EXTENT)) {
104 * SMSC FDC37C93xAPM SuperIO chip
106 * Serial #2
108 result = IO_SUPERIO_PHYS + (offset << 1);
109 } else if ((offset >= IO_ISP1161_BASE) &&
110 (offset < IO_ISP1161_BASE + IO_ISP1161_EXTENT)) {
112 * Philips USB ISP1161x chip
114 result = IO_ISP1161_PHYS + offset - IO_ISP1161_BASE;
115 } else {
117 * safe default.
119 printk("Warning: unexpected port in %s( offset = 0x%lx )\n",
120 __func__, offset);
121 result = PVR;
124 return (void __iomem *)result;