setup.c 4.3 KB
Newer Older
L
Linus Torvalds 已提交
1
/*
2
 * linux/arch/arm/mach-iop33x/setup.c
L
Linus Torvalds 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15
 *
 * Author: Dave Jiang (dave.jiang@intel.com)
 * Copyright (C) 2004 Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/major.h>
#include <linux/fs.h>
16
#include <linux/platform_device.h>
L
Linus Torvalds 已提交
17 18
#include <linux/serial.h>
#include <linux/tty.h>
19
#include <linux/serial_8250.h>
L
Linus Torvalds 已提交
20 21 22 23 24 25 26 27 28 29 30

#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/mach/map.h>
#include <asm/setup.h>
#include <asm/system.h>
#include <asm/memory.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
31
#include <asm/hardware/iop3xx.h>
L
Linus Torvalds 已提交
32 33 34

#define IOP331_UART_XTAL 33334000

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
static struct resource iop33x_uart0_resources[] = {
	[0] = {
		.start = IOP331_UART0_PHYS,
		.end = IOP331_UART0_PHYS + 0x3f,
		.flags = IORESOURCE_MEM,
	},
	[1] = {
		.start = IRQ_IOP331_UART0,
		.end = IRQ_IOP331_UART0,
		.flags = IORESOURCE_IRQ
	}
};

static struct resource iop33x_uart1_resources[] = {
	[0] = {
		.start = IOP331_UART1_PHYS,
		.end = IOP331_UART1_PHYS + 0x3f,
		.flags = IORESOURCE_MEM,
	},
	[1] = {
		.start = IRQ_IOP331_UART1,
		.end = IRQ_IOP331_UART1,
		.flags = IORESOURCE_IRQ
L
Linus Torvalds 已提交
58 59 60
	}
};

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
static struct plat_serial8250_port iop33x_uart0_data[] = {
	{
       .membase     = (char*)(IOP331_UART0_VIRT),
       .mapbase     = (IOP331_UART0_PHYS),
       .irq         = IRQ_IOP331_UART0,
       .uartclk     = IOP331_UART_XTAL,
       .regshift    = 2,
       .iotype      = UPIO_MEM,
       .flags       = UPF_SKIP_TEST,
	},
	{  },
};

static struct plat_serial8250_port iop33x_uart1_data[] = {
	{
       .membase     = (char*)(IOP331_UART1_VIRT),
       .mapbase     = (IOP331_UART1_PHYS),
       .irq         = IRQ_IOP331_UART1,
       .uartclk     = IOP331_UART_XTAL,
       .regshift    = 2,
       .iotype      = UPIO_MEM,
       .flags       = UPF_SKIP_TEST,
	},
	{  },
};

static struct platform_device iop33x_uart0 = {
       .name = "serial8250",
89
       .id = PLAT8250_DEV_PLATFORM,
90 91 92 93 94 95 96
       .dev.platform_data = iop33x_uart0_data,
       .num_resources = 2,
       .resource = iop33x_uart0_resources,
};

static struct platform_device iop33x_uart1 = {
       .name = "serial8250",
97
       .id = PLAT8250_DEV_PLATFORM1,
98 99 100 101 102
       .dev.platform_data = iop33x_uart1_data,
       .num_resources = 2,
       .resource = iop33x_uart1_resources,
};

L
Linus Torvalds 已提交
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
static struct resource iop33x_i2c_0_resources[] = {
	[0] = {
		.start = 0xfffff680,
		.end = 0xfffff698,
		.flags = IORESOURCE_MEM,
	},
	[1] = {
		.start = IRQ_IOP331_I2C_0,
		.end = IRQ_IOP331_I2C_0,
		.flags = IORESOURCE_IRQ
	}
};

static struct resource iop33x_i2c_1_resources[] = {
	[0] = {
		.start = 0xfffff6a0,
		.end = 0xfffff6b8,
		.flags = IORESOURCE_MEM,
	},
	[1] = {
		.start = IRQ_IOP331_I2C_1,
		.end = IRQ_IOP331_I2C_1,
		.flags = IORESOURCE_IRQ
	}
};

static struct platform_device iop33x_i2c_0_controller = {
	.name = "IOP3xx-I2C",
	.id = 0,
	.num_resources = 2,
	.resource = iop33x_i2c_0_resources
};

static struct platform_device iop33x_i2c_1_controller = {
	.name = "IOP3xx-I2C",
	.id = 1,
	.num_resources = 2,
	.resource = iop33x_i2c_1_resources
};

static struct platform_device *iop33x_devices[] __initdata = {
144 145
	&iop33x_uart0,
	&iop33x_uart1,
L
Linus Torvalds 已提交
146 147 148 149 150 151 152 153 154 155 156 157 158
	&iop33x_i2c_0_controller,
	&iop33x_i2c_1_controller
};

void __init iop33x_init(void)
{
	if(iop_is_331())
	{
		platform_add_devices(iop33x_devices,
				ARRAY_SIZE(iop33x_devices));
	}
}

159
#ifdef CONFIG_ARCH_IOP33X
L
Linus Torvalds 已提交
160 161 162 163 164 165
extern void iop331_init_irq(void);
extern struct sys_timer iop331_timer;
#endif

#if defined(CONFIG_ARCH_IQ80331)
MACHINE_START(IQ80331, "Intel IQ80331")
166 167 168
	/* Maintainer: Intel Corp. */
	.phys_io	= 0xfefff000,
	.io_pg_offst	= ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
169
	.map_io		= iop3xx_map_io,
170
	.init_irq	= iop331_init_irq,
L
Linus Torvalds 已提交
171
	.timer		= &iop331_timer,
172 173
	.boot_params	= 0x0100,
	.init_machine	= iop33x_init,
L
Linus Torvalds 已提交
174 175 176 177
MACHINE_END

#elif defined(CONFIG_MACH_IQ80332)
MACHINE_START(IQ80332, "Intel IQ80332")
178 179 180
	/* Maintainer: Intel Corp. */
	.phys_io	= 0xfefff000,
	.io_pg_offst	= ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
181
	.map_io		= iop3xx_map_io,
182
	.init_irq	= iop331_init_irq,
L
Linus Torvalds 已提交
183
	.timer		= &iop331_timer,
184 185
	.boot_params	= 0x0100,
	.init_machine	= iop33x_init,
L
Linus Torvalds 已提交
186 187 188 189 190 191 192
MACHINE_END

#else
#error No machine descriptor defined for this IOP3XX implementation
#endif