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

📄 generic.c

📁 the attached file is the driver of Uart
💻 C
字号:
/* *  File Name	    : linux/arch/arm/mach-mp200/generic.c *  Function	    : generic *  Release Version : Ver 1.05 *  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/sched.h>#include <linux/mm.h>#include <linux/init.h>#include <linux/module.h>#include <linux/device.h>#include <linux/serial.h>#include <linux/serial_core.h>#include <linux/kgdb.h>#include <asm/hardware.h>#include <asm/io.h>#include <asm/pgtable.h>#include <asm/page.h>#include <asm/mach/map.h>#include <asm/arch/pmu.h>#include "generic.h"/* * Common MP200 I/O Mapping *  * Logical	Physical * e4000000	40000000	APB0 * e5000000	50000000	ASYNC1 * e6000000	60000000	AHB Slave * e8000000	80000000	Local * ec000000	c0000000	APB1 */static struct map_desc standard_io_desc[] __initdata = {	/* BANK 4 */	MP200_MAP_DESC(MP200_TI1_BASE, MP200_TI1_SIZE),	MP200_MAP_DESC(MP200_TI2_BASE, MP200_TI2_SIZE),	MP200_MAP_DESC(MP200_TI3_BASE, MP200_TI3_SIZE),	MP200_MAP_DESC(MP200_TI4_BASE, MP200_TI4_SIZE),	MP200_MAP_DESC(MP200_TI5_BASE, MP200_TI5_SIZE),	MP200_MAP_DESC(MP200_WDT1_BASE, MP200_WDT1_SIZE),	MP200_MAP_DESC(MP200_DCV_BASE, MP200_DCV_SIZE),	MP200_MAP_DESC(MP200_FIFO_BASE, MP200_FIFO_SIZE),	MP200_MAP_DESC(MP200_ROTATOR_BASE, MP200_ROTATOR_SIZE),	MP200_MAP_DESC(MP200_DMAC_BASE, MP200_DMAC_SIZE),	MP200_MAP_DESC(MP200_IMAGEPROC_BASE, MP200_IMAGEPROC_SIZE),	MP200_MAP_DESC(MP200_CAMERA_BASE, MP200_CAMERA_SIZE),	MP200_MAP_DESC(MP200_PCM0_BASE, MP200_PCM0_SIZE),	MP200_MAP_DESC(MP200_PCM1_BASE, MP200_PCM1_SIZE),	MP200_MAP_DESC(MP200_NTSC_BASE, MP200_NTSC_SIZE),	MP200_MAP_DESC(MP200_PB0_BASE, MP200_PB0_SIZE),	MP200_MAP_DESC(MP200_SWT_BASE, MP200_SWT_SIZE),	MP200_MAP_DESC(MP200_SP0_BASE, MP200_SP0_SIZE),	MP200_MAP_DESC(MP200_SP1_BASE, MP200_SP1_SIZE),	MP200_MAP_DESC(MP200_DTV_BASE, MP200_DTV_SIZE),	MP200_MAP_DESC(MP200_NAND_BASE, MP200_NAND_SIZE),	MP200_MAP_DESC(MP200_STM_BASE, MP200_STM_SIZE),	MP200_MAP_DESC(MP200_DMAC_S0_BASE, MP200_DMAC_S0_SIZE),	MP200_MAP_DESC(MP200_FIFO_S1_BASE, MP200_FIFO_S1_SIZE),	/* BANK5 */	MP200_MAP_DESC(MP200_UART0_BASE, MP200_UART0_SIZE),	MP200_MAP_DESC(MP200_I2C_BASE, MP200_I2C_SIZE),	MP200_MAP_DESC(MP200_AB1_BASE, MP200_AB1_SIZE),	MP200_MAP_DESC(MP200_SDM_S0_BASE, MP200_SDM_S0_SIZE),	/* BANK 8 */	MP200_MAP_DESC(MP200_PEID_BASE, MP200_PEID_SIZE),	/* BANK 10 */	MP200_MAP_DESC(MP200_SSRAM_BASE, MP200_SSRAM_SIZE),	/* BANK 11 */	MP200_MAP_DESC(MP200_USB_BASE, MP200_USB_SIZE),	MP200_MAP_DESC(MP200_ATA_BASE, MP200_ATA_SIZE),	MP200_MAP_DESC(MP200_MSP_BASE, MP200_MSP_SIZE),	MP200_MAP_DESC(MP200_MMM_BASE, MP200_MMM_SIZE),	/* BANK 12 */	MP200_MAP_DESC(MP200_TI0_BASE, MP200_TI0_SIZE),	MP200_MAP_DESC(MP200_WDT0_BASE, MP200_WDT0_SIZE),	MP200_MAP_DESC(MP200_INTC_BASE, MP200_INTC_SIZE),	MP200_MAP_DESC(MP200_TFD_BASE, MP200_TFD_SIZE),	MP200_MAP_DESC(MP200_LCDC_BASE, MP200_LCDC_SIZE),	MP200_MAP_DESC(MP200_GPIO_BASE, MP200_GPIO_SIZE),	MP200_MAP_DESC(MP200_PWM_BASE, MP200_PWM_SIZE),	MP200_MAP_DESC(MP200_PB1_BASE, MP200_PB1_SIZE),	MP200_MAP_DESC(MP200_PMU_BASE, MP200_PMU_SIZE),	MP200_MAP_DESC(MP200_SMU_S0_BASE, MP200_SMU_S0_SIZE),	MP200_MAP_DESC(MP200_uWIRE_BASE, MP200_uWIRE_SIZE),	MP200_MAP_DESC(MP200_SMU_S1_BASE, MP200_SMU_S1_SIZE),	MP200_MAP_DESC(MP200_INTC_S1_BASE, MP200_INTC_S1_SIZE)};static struct uart_port serial_platform_data[] = {	{	 .membase = (char *)IO_ADDRESS(MP200_UART0_BASE),	 .mapbase = (unsigned long)MP200_UART0_BASE,	 .irq = INT_UART0,	 .flags = UPF_BOOT_AUTOCONF,	 .iotype = UPIO_MEM,	 .regshift = 0,	 .uartclk = MP200_BASE_BAUD,	 },	{	 /* terminate */	 },};static struct platform_device dma_device = {	.name = "dma",	.id = -1,};static struct platform_device i2c_device = {	.name = "i2c",	.id = -1,};static struct platform_device spi0_device = {	.name = "spi",	.id = 0,};static struct platform_device spi1_device = {	.name = "spi",	.id = 1,};static struct platform_device pcm_device = {	.name = "pcm",	.id = -1,};static struct platform_device mp200_fb_device = {	.name = "mp200_fb",	.id = -1,};static struct platform_device mp200_image_device = {	.name = "mp200_image",	.id = -1,};static struct platform_device mp200_rotator_device = {	.name = "mp200_rotator",	.id = -1,};static struct platform_device mp200_camera_device = {	.name = "mp200_camera",	.id = -1,};static struct platform_device mp200_dsp_device = {	.name = "mp200_dsp",	.id = -1,};static struct platform_device mp200_ntsc_device = {	.name = "mp200_ntsc",	.id = -1,};static struct platform_device mp200_dtv_device = {	.name = "mp200_dtv",	.id = -1,};static struct platform_device mp200_usb_otg_device = {	.name = "mp200_usb_otg",	.id = -1,};static struct platform_device *platform_devs[] __initdata = {	&dma_device,	&i2c_device,	&spi0_device,	&spi1_device,	&mp200_fb_device,	&mp200_image_device,	&mp200_rotator_device,	&mp200_camera_device,	&mp200_dsp_device,	&mp200_ntsc_device,	&mp200_dtv_device,	&pcm_device,	&mp200_usb_otg_device,};void __init mp200_map_io(void){	iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));}void __init mp200_serial_init(void){	int i = 0;	/* reset U70 */	mp200_pmu_reset_device(MP200_RESETDEVICE_U70);	serial_platform_data[i].line = i;#ifdef CONFIG_SERIAL_8250	early_serial_setup(&serial_platform_data[i]);#endif	mp200_pmu_unreset_device(MP200_RESETDEVICE_U70);}static int __init mp200_init(void){	return platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));}arch_initcall(mp200_init);

⌨️ 快捷键说明

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