PageRenderTime 15ms CodeModel.GetById 6ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/arm/mach-iop3xx/iop331-setup.c

https://bitbucket.org/evzijst/gittest
C | 177 lines | 137 code | 21 blank | 19 comment | 2 complexity | 6ee6466a6b2309f497c13b7ede11b98a MD5 | raw file
  1/*
  2 * linux/arch/arm/mach-iop3xx/iop331-setup.c
  3 *
  4 * Author: Dave Jiang (dave.jiang@intel.com)
  5 * Copyright (C) 2004 Intel Corporation.
  6 *
  7 * This program is free software; you can redistribute it and/or modify
  8 * it under the terms of the GNU General Public License version 2 as
  9 * published by the Free Software Foundation.
 10 *
 11 */
 12#include <linux/mm.h>
 13#include <linux/init.h>
 14#include <linux/config.h>
 15#include <linux/init.h>
 16#include <linux/major.h>
 17#include <linux/fs.h>
 18#include <linux/device.h>
 19#include <linux/serial.h>
 20#include <linux/tty.h>
 21#include <linux/serial_core.h>
 22
 23#include <asm/io.h>
 24#include <asm/pgtable.h>
 25#include <asm/page.h>
 26#include <asm/mach/map.h>
 27#include <asm/setup.h>
 28#include <asm/system.h>
 29#include <asm/memory.h>
 30#include <asm/hardware.h>
 31#include <asm/mach-types.h>
 32#include <asm/mach/arch.h>
 33
 34#define IOP331_UART_XTAL 33334000
 35
 36/*
 37 * Standard IO mapping for all IOP331 based systems
 38 */
 39static struct map_desc iop331_std_desc[] __initdata = {
 40 /* virtual     physical      length      type */
 41
 42 /* mem mapped registers */
 43 { IOP331_VIRT_MEM_BASE,  IOP331_PHYS_MEM_BASE,   0x00002000,  MT_DEVICE },
 44
 45 /* PCI IO space */
 46 { IOP331_PCI_LOWER_IO_VA,  IOP331_PCI_LOWER_IO_PA,   IOP331_PCI_IO_WINDOW_SIZE,  MT_DEVICE }
 47};
 48
 49static struct uart_port iop331_serial_ports[] = {
 50	{
 51		.membase	= (char*)(IOP331_UART0_VIRT),
 52		.mapbase	= (IOP331_UART0_PHYS),
 53		.irq		= IRQ_IOP331_UART0,
 54		.flags		= UPF_SKIP_TEST,
 55		.iotype		= UPIO_MEM,
 56		.regshift	= 2,
 57		.uartclk	= IOP331_UART_XTAL,
 58		.line		= 0,
 59		.type		= PORT_XSCALE,
 60		.fifosize	= 32
 61	} , {
 62		.membase	= (char*)(IOP331_UART1_VIRT),
 63		.mapbase	= (IOP331_UART1_PHYS),
 64		.irq		= IRQ_IOP331_UART1,
 65		.flags		= UPF_SKIP_TEST,
 66		.iotype		= UPIO_MEM,
 67		.regshift	= 2,
 68		.uartclk	= IOP331_UART_XTAL,
 69		.line		= 1,
 70		.type		= PORT_XSCALE,
 71		.fifosize	= 32
 72	}
 73};
 74
 75static struct resource iop33x_i2c_0_resources[] = {
 76	[0] = {
 77		.start = 0xfffff680,
 78		.end = 0xfffff698,
 79		.flags = IORESOURCE_MEM,
 80	},
 81	[1] = {
 82		.start = IRQ_IOP331_I2C_0,
 83		.end = IRQ_IOP331_I2C_0,
 84		.flags = IORESOURCE_IRQ
 85	}
 86};
 87
 88static struct resource iop33x_i2c_1_resources[] = {
 89	[0] = {
 90		.start = 0xfffff6a0,
 91		.end = 0xfffff6b8,
 92		.flags = IORESOURCE_MEM,
 93	},
 94	[1] = {
 95		.start = IRQ_IOP331_I2C_1,
 96		.end = IRQ_IOP331_I2C_1,
 97		.flags = IORESOURCE_IRQ
 98	}
 99};
100
101static struct platform_device iop33x_i2c_0_controller = {
102	.name = "IOP3xx-I2C",
103	.id = 0,
104	.num_resources = 2,
105	.resource = iop33x_i2c_0_resources
106};
107
108static struct platform_device iop33x_i2c_1_controller = {
109	.name = "IOP3xx-I2C",
110	.id = 1,
111	.num_resources = 2,
112	.resource = iop33x_i2c_1_resources
113};
114
115static struct platform_device *iop33x_devices[] __initdata = {
116	&iop33x_i2c_0_controller,
117	&iop33x_i2c_1_controller
118};
119
120void __init iop33x_init(void)
121{
122	if(iop_is_331())
123	{
124		platform_add_devices(iop33x_devices,
125				ARRAY_SIZE(iop33x_devices));
126	}
127}
128
129void __init iop331_map_io(void)
130{
131	iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
132	early_serial_setup(&iop331_serial_ports[0]);
133	early_serial_setup(&iop331_serial_ports[1]);
134}
135
136#ifdef CONFIG_ARCH_IOP331
137extern void iop331_init_irq(void);
138extern struct sys_timer iop331_timer;
139#endif
140
141#ifdef CONFIG_ARCH_IQ80331
142extern void iq80331_map_io(void);
143#endif
144
145#ifdef CONFIG_MACH_IQ80332
146extern void iq80332_map_io(void);
147#endif
148
149#if defined(CONFIG_ARCH_IQ80331)
150MACHINE_START(IQ80331, "Intel IQ80331")
151    MAINTAINER("Intel Corp.")
152    BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical
153    //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS)
154    MAPIO(iq80331_map_io)
155    INITIRQ(iop331_init_irq)
156	.timer		= &iop331_timer,
157    BOOT_PARAMS(0x0100)
158	INIT_MACHINE(iop33x_init)
159MACHINE_END
160
161#elif defined(CONFIG_MACH_IQ80332)
162MACHINE_START(IQ80332, "Intel IQ80332")
163    MAINTAINER("Intel Corp.")
164    BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical
165    //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS)
166    MAPIO(iq80332_map_io)
167    INITIRQ(iop331_init_irq)
168	.timer		= &iop331_timer,
169    BOOT_PARAMS(0x0100)
170	INIT_MACHINE(iop33x_init)
171MACHINE_END
172
173#else
174#error No machine descriptor defined for this IOP3XX implementation
175#endif
176
177