Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Setup pointers to hardware-dependent routines. |
| 3 | * |
| 4 | * This file is subject to the terms and conditions of the GNU General Public |
| 5 | * License. See the file "COPYING" in the main directory of this archive |
| 6 | * for more details. |
| 7 | * |
| 8 | * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle |
| 9 | * Copyright (C) 2001 MIPS Technologies, Inc. |
Thomas Bogendoerfer | ea202c6 | 2007-08-25 11:01:50 +0200 | [diff] [blame] | 10 | * Copyright (C) 2007 by Thomas Bogendoerfer |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/eisa.h> |
| 13 | #include <linux/hdreg.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/ioport.h> |
| 16 | #include <linux/sched.h> |
| 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/mm.h> |
| 19 | #include <linux/console.h> |
| 20 | #include <linux/fb.h> |
| 21 | #include <linux/ide.h> |
Ralf Baechle | fcdb27a | 2006-01-18 17:37:07 +0000 | [diff] [blame] | 22 | #include <linux/pm.h> |
Ralf Baechle | 06e8011 | 2006-10-08 19:35:00 +0100 | [diff] [blame] | 23 | #include <linux/screen_info.h> |
Thomas Bogendoerfer | ea202c6 | 2007-08-25 11:01:50 +0200 | [diff] [blame] | 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/serial_8250.h> |
Ralf Baechle | fcdb27a | 2006-01-18 17:37:07 +0000 | [diff] [blame] | 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <asm/bootinfo.h> |
Ralf Baechle | d865bea | 2007-10-11 23:46:10 +0100 | [diff] [blame] | 28 | #include <asm/i8253.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include <asm/irq.h> |
| 30 | #include <asm/jazz.h> |
| 31 | #include <asm/jazzdma.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include <asm/reboot.h> |
| 33 | #include <asm/io.h> |
| 34 | #include <asm/pgtable.h> |
| 35 | #include <asm/time.h> |
| 36 | #include <asm/traps.h> |
Thomas Bogendoerfer | ea202c6 | 2007-08-25 11:01:50 +0200 | [diff] [blame] | 37 | #include <asm/mc146818-time.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | extern asmlinkage void jazz_handle_int(void); |
| 40 | |
| 41 | extern void jazz_machine_restart(char *command); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | static struct resource jazz_io_resources[] = { |
Ralf Baechle | 2cf69e7 | 2006-10-08 19:19:11 +0100 | [diff] [blame] | 44 | { |
| 45 | .start = 0x00, |
| 46 | .end = 0x1f, |
| 47 | .name = "dma1", |
| 48 | .flags = IORESOURCE_BUSY |
| 49 | }, { |
| 50 | .start = 0x40, |
| 51 | .end = 0x5f, |
| 52 | .name = "timer", |
Alexey Dobriyan | 5da44ad | 2007-06-27 14:10:06 -0700 | [diff] [blame] | 53 | .flags = IORESOURCE_BUSY |
Ralf Baechle | 2cf69e7 | 2006-10-08 19:19:11 +0100 | [diff] [blame] | 54 | }, { |
| 55 | .start = 0x80, |
| 56 | .end = 0x8f, |
| 57 | .name = "dma page reg", |
| 58 | .flags = IORESOURCE_BUSY |
| 59 | }, { |
| 60 | .start = 0xc0, |
| 61 | .end = 0xdf, |
| 62 | .name = "dma2", |
| 63 | .flags = IORESOURCE_BUSY |
| 64 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
Ralf Baechle | d865bea | 2007-10-11 23:46:10 +0100 | [diff] [blame] | 67 | void __init plat_time_init(void) |
| 68 | { |
| 69 | setup_pit_timer(); |
| 70 | } |
| 71 | |
Ralf Baechle | 2925aba | 2006-06-18 01:32:22 +0100 | [diff] [blame] | 72 | void __init plat_mem_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | { |
| 74 | int i; |
| 75 | |
| 76 | /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */ |
Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame^] | 77 | add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */ |
Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame^] | 79 | add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */ |
Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame^] | 81 | add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
| 83 | set_io_port_base(JAZZ_PORT_BASE); |
| 84 | #ifdef CONFIG_EISA |
| 85 | if (mips_machtype == MACH_MIPS_MAGNUM_4000) |
| 86 | EISA_bus = 1; |
| 87 | #endif |
| 88 | isa_slot_offset = 0xe3000000; |
| 89 | |
| 90 | /* request I/O space for devices used on all i[345]86 PCs */ |
| 91 | for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++) |
| 92 | request_resource(&ioport_resource, jazz_io_resources + i); |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | /* The RTC is outside the port address space */ |
| 95 | |
| 96 | _machine_restart = jazz_machine_restart; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | |
Thomas Bogendoerfer | ea202c6 | 2007-08-25 11:01:50 +0200 | [diff] [blame] | 98 | #ifdef CONFIG_VT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | screen_info = (struct screen_info) { |
| 100 | 0, 0, /* orig-x, orig-y */ |
| 101 | 0, /* unused */ |
| 102 | 0, /* orig_video_page */ |
| 103 | 0, /* orig_video_mode */ |
| 104 | 160, /* orig_video_cols */ |
| 105 | 0, 0, 0, /* unused, ega_bx, unused */ |
| 106 | 64, /* orig_video_lines */ |
| 107 | 0, /* orig_video_isVGA */ |
| 108 | 16 /* orig_video_points */ |
| 109 | }; |
Thomas Bogendoerfer | ea202c6 | 2007-08-25 11:01:50 +0200 | [diff] [blame] | 110 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Thomas Bogendoerfer | ea202c6 | 2007-08-25 11:01:50 +0200 | [diff] [blame] | 112 | add_preferred_console("ttyS", 0, "9600"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | } |
Thomas Bogendoerfer | ea202c6 | 2007-08-25 11:01:50 +0200 | [diff] [blame] | 114 | |
| 115 | #ifdef CONFIG_OLIVETTI_M700 |
| 116 | #define UART_CLK 1843200 |
| 117 | #else |
| 118 | /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know |
| 119 | exactly which ones ... XXX */ |
| 120 | #define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */ |
| 121 | #endif |
| 122 | |
| 123 | #define MEMPORT(_base, _irq) \ |
| 124 | { \ |
| 125 | .mapbase = (_base), \ |
| 126 | .membase = (void *)(_base), \ |
| 127 | .irq = (_irq), \ |
| 128 | .uartclk = UART_CLK, \ |
| 129 | .iotype = UPIO_MEM, \ |
| 130 | .flags = UPF_BOOT_AUTOCONF, \ |
| 131 | } |
| 132 | |
| 133 | static struct plat_serial8250_port jazz_serial_data[] = { |
| 134 | MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ), |
| 135 | MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ), |
| 136 | { }, |
| 137 | }; |
| 138 | |
| 139 | static struct platform_device jazz_serial8250_device = { |
| 140 | .name = "serial8250", |
| 141 | .id = PLAT8250_DEV_PLATFORM, |
| 142 | .dev = { |
| 143 | .platform_data = jazz_serial_data, |
| 144 | }, |
| 145 | }; |
| 146 | |
| 147 | static struct resource jazz_esp_rsrc[] = { |
| 148 | { |
| 149 | .start = JAZZ_SCSI_BASE, |
| 150 | .end = JAZZ_SCSI_BASE + 31, |
| 151 | .flags = IORESOURCE_MEM |
| 152 | }, |
| 153 | { |
| 154 | .start = JAZZ_SCSI_DMA, |
| 155 | .end = JAZZ_SCSI_DMA, |
| 156 | .flags = IORESOURCE_MEM |
| 157 | }, |
| 158 | { |
| 159 | .start = JAZZ_SCSI_IRQ, |
| 160 | .end = JAZZ_SCSI_IRQ, |
| 161 | .flags = IORESOURCE_IRQ |
| 162 | } |
| 163 | }; |
| 164 | |
| 165 | static struct platform_device jazz_esp_pdev = { |
| 166 | .name = "jazz_esp", |
| 167 | .num_resources = ARRAY_SIZE(jazz_esp_rsrc), |
| 168 | .resource = jazz_esp_rsrc |
| 169 | }; |
| 170 | |
| 171 | static struct resource jazz_sonic_rsrc[] = { |
| 172 | { |
| 173 | .start = JAZZ_ETHERNET_BASE, |
| 174 | .end = JAZZ_ETHERNET_BASE + 0xff, |
| 175 | .flags = IORESOURCE_MEM |
| 176 | }, |
| 177 | { |
| 178 | .start = JAZZ_ETHERNET_IRQ, |
| 179 | .end = JAZZ_ETHERNET_IRQ, |
| 180 | .flags = IORESOURCE_IRQ |
| 181 | } |
| 182 | }; |
| 183 | |
| 184 | static struct platform_device jazz_sonic_pdev = { |
| 185 | .name = "jazzsonic", |
| 186 | .num_resources = ARRAY_SIZE(jazz_sonic_rsrc), |
| 187 | .resource = jazz_sonic_rsrc |
| 188 | }; |
| 189 | |
| 190 | static struct resource jazz_cmos_rsrc[] = { |
| 191 | { |
| 192 | .start = 0x70, |
| 193 | .end = 0x71, |
| 194 | .flags = IORESOURCE_IO |
| 195 | }, |
| 196 | { |
| 197 | .start = 8, |
| 198 | .end = 8, |
| 199 | .flags = IORESOURCE_IRQ |
| 200 | } |
| 201 | }; |
| 202 | |
| 203 | static struct platform_device jazz_cmos_pdev = { |
| 204 | .name = "rtc_cmos", |
| 205 | .num_resources = ARRAY_SIZE(jazz_cmos_rsrc), |
| 206 | .resource = jazz_cmos_rsrc |
| 207 | }; |
| 208 | |
| 209 | static int __init jazz_setup_devinit(void) |
| 210 | { |
| 211 | platform_device_register(&jazz_serial8250_device); |
| 212 | platform_device_register(&jazz_esp_pdev); |
| 213 | platform_device_register(&jazz_sonic_pdev); |
| 214 | platform_device_register(&jazz_cmos_pdev); |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | device_initcall(jazz_setup_devinit); |