⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mp200_board.c

📁 the attached file is the driver of Uart
💻 C
字号:
/* *  File Name	    : linux/arch/arm/mach-mp200/mp200_board.c *  Function	    : mp200_board *  Release Version : Ver 1.02 *  Release Date    : 2006/09/22 * *  Copyright (C) NEC Electronics Corporation 2005-2006 * * *  This program is free software;you can redistribute it and/or modify it under the terms of *  the GNU General Public License as published by Free Softwere Foundation; either version 2 *  of License, or (at your option) any later version. * *  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; *  without even the implied warrnty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *  See the GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License along with this program; *  If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *  MA 02111-1307, USA. * */#include <linux/device.h>#include <linux/init.h>#include <linux/interrupt.h>#include <linux/types.h>#include <linux/mtd/nand.h>#include <linux/mtd/partitions.h>#include <asm/hardware.h>#include <asm/io.h>#include <asm/setup.h>#include <asm/mach-types.h>#include <asm/mach/arch.h>#include <asm/mach/map.h>#include <asm/mach/flash.h>#include <asm/arch/gio.h>#include <asm/arch/gpiocore.h>#include "generic.h"#include "time.h"#define GPIO_INPORT	0xFFFFFFDFFFFFFE7FULL	/* GPIO input */static struct map_desc mp200_board_io_desc[] __initdata = {	/* BANK2 */	MP200_MAP_DESC(MP200_EXTDEVICE_BASE, MP200_EXTDEVICE_SIZE),	MP200_MAP_DESC(MP200_ASYNC0_BASE, MP200_ASYNC0_SIZE),};static struct resource smc91x_resources[] = {	[0] = {	       .start = MP200_ETHER_BASE,	       .end = MP200_ETHER_BASE + MP200_ETHER_SIZE - 1,	       .flags = IORESOURCE_MEM,	       },	[1] = {	       .start = INT_GPIO_ETHER_INT,	       .end = INT_GPIO_ETHER_INT,	       .flags = IORESOURCE_IRQ,	       },};static struct platform_device smc91x_device = {	.name = "smc91x",	.id = -1,	.num_resources = ARRAY_SIZE(smc91x_resources),	.resource = smc91x_resources,};static struct mtd_partition mp200_nand_partition[] = {	{	 .name = "nand boot",	 .offset = 0,	 .size = 0x00200000,	 },	{	 .name = "nand kernel",	 .offset = MTDPART_OFS_APPEND, 	 .size = 0x00400000,	 },	{	 .name = "nand rootfs",	 .offset = MTDPART_OFS_APPEND, 	 .size = 0x01A00000, 	 },	{	 .name = "nand data",	 .offset = MTDPART_OFS_APPEND, 	 .size = MTDPART_SIZ_FULL, 	},};static struct flash_platform_data mp200_nand_data = {	.map_name = "mp200_nand",	.parts = mp200_nand_partition,	.nr_parts = ARRAY_SIZE(mp200_nand_partition),};static struct platform_device mp200_nand_device = {	.name = "mp200_nand",	.id = -1,	.dev = {		.platform_data = &mp200_nand_data,		},};static struct mtd_partition mp200_flash0_partitions[] = {	{	 .name = "Boot",	 .offset = 0,	 .size = 0x00200000,	 .mask_flags = MTD_WRITEABLE,	/* force read-only */	 },	{	 .name = "Kernel",	 .offset = MTDPART_OFS_APPEND,	 .size = 0x00400000,	 .mask_flags = MTD_WRITEABLE,	/* force read-only */	 },	{	 .name = "Root",	 .offset = MTDPART_OFS_APPEND,	 .size = 0x01a00000,	 .mask_flags = MTD_WRITEABLE,	/* force read-only */	 },};static struct flash_platform_data mp200_flash0_data = {	.map_name = "cfi_probe",	.width = 2,	.parts = mp200_flash0_partitions,	.nr_parts = ARRAY_SIZE(mp200_flash0_partitions),};static struct resource mp200_flash0_resource = {	.start = MP200_FLASH_BASE,	.end = MP200_FLASH_BASE + SZ_32M - 1,	.flags = IORESOURCE_MEM,};static struct platform_device mp200_flash0_device = {	.name = "mp200_flash",	.id = 0,	.dev = {		.platform_data = &mp200_flash0_data,		},	.num_resources = 1,	.resource = &mp200_flash0_resource,};static struct platform_device mp200_touchscreen_device = {	.name = "mp200_touchscreen",	.id = -1,};static struct platform_device *devs[] __initdata = {	&smc91x_device,	&mp200_nand_device,	&mp200_flash0_device,	&mp200_touchscreen_device,};static void __init fixup_mp200_board(struct machine_desc *desc,				     struct tag *tags, char **cmdline,				     struct meminfo *mi){	/* none */}static void __init mp200_board_map_io(void){	mp200_map_io();	iotable_init(mp200_board_io_desc, ARRAY_SIZE(mp200_board_io_desc));	mp200_serial_init();}static void __init mp200_board_init(void){	/* initialize GPIO register */	/* GPIO set output port	 */	mp200_gio_set_mode_output(~GPIO_INPORT);	/* GPIO set input port */	mp200_gio_set_mode_input(GPIO_INPORT);}static int __init mp200_board_device_init(void){	return platform_add_devices(devs, ARRAY_SIZE(devs));}arch_initcall(mp200_board_device_init);MACHINE_START(MP200, "MP200")    MAINTAINER("NEC Electronics Corp.")    BOOT_MEM(PHYS_OFFSET, MP200_BANK5_BASE, IO_ADDRESS(MP200_BANK5_BASE))    BOOT_PARAMS(PHYS_OFFSET + 0x100)    FIXUP(fixup_mp200_board)    MAPIO(mp200_board_map_io)    INITIRQ(mp200_init_irq)    INIT_MACHINE(mp200_board_init)    .timer = &mp200_timer, MACHINE_END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -