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