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