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