Linux Audio

Check our new training course

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