innokom.c

来自「优龙2410linux2.6.8内核源代码」· C语言 代码 · 共 206 行

C
206
字号
/* *  linux/arch/arm/mach-pxa/innokom.c * * (c) 2004 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix * * 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 * the Free Software Foundation; either version 2 of the 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 warranty 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/kernel.h>#include <linux/init.h>#include <linux/device.h>#include <linux/major.h>#include <linux/fs.h>#include <linux/interrupt.h>#include <asm/setup.h>#include <asm/memory.h>#include <asm/mach-types.h>#include <asm/hardware.h>#include <asm/irq.h>#include <asm/mach/arch.h>#include <asm/mach/map.h>#include <asm/mach/irq.h>#include <asm/arch/irq.h>//#include <asm/arch/irqs.h>#include <asm/arch/innokom.h>#include "generic.h"/* * Interrupt Handler for Software Update button */static irqreturn_t sw_update_handler(int irq, void* dev_id,struct pt_regs* regs){	printk("software update button pressed (I'm the dummy irq handler)\n");	printk("USIR0  = %08x\n", USIR0);	printk("UDCCR  = %08x\n", UDCCR);	printk("UDCCS0 = %08x\n", UDCCS0);	return IRQ_HANDLED;}/* * Interrupt Handler for Reset button */static irqreturn_t reset_handler(int irq, void* dev_id,struct pt_regs* regs){	return IRQ_HANDLED;}/*  * Interrupt Initialisation */static void __init innokom_init_irq(void){	pxa_init_irq();		set_irq_type(INNOKOM_SW_UPDATE_IRQ, INNOKOM_SW_UPDATE_IRQ_EDGE);	set_irq_type(INNOKOM_RESET_IRQ, INNOKOM_RESET_IRQ_EDGE);	set_irq_type(INNOKOM_ETH_IRQ, INNOKOM_ETH_IRQ_EDGE);	set_irq_type(INNOKOM_USB_DISC_IRQ, INNOKOM_USB_DISC_IRQ_EDGE);}/* * Ressource entries for onboard devices */static struct resource smc91x_resources[] = {        [0] = {                .start  = INNOKOM_ETH_PHYS,                .end    = INNOKOM_ETH_PHYS + INNOKOM_ETH_SIZE - 1,                .flags  = IORESOURCE_MEM,        },        [1] = {                .start  = INNOKOM_ETH_IRQ,                .end    = INNOKOM_ETH_IRQ,                .flags  = IORESOURCE_IRQ,        },};static struct platform_device smc91x_device = {	.name		= "smc91x",	.id		= 0,	.num_resources	= ARRAY_SIZE(smc91x_resources),	.resource	= smc91x_resources,};static struct resource innokom_switches_resources[] = {        [0] = {                .start  = INNOKOM_SW_UPDATE_IRQ,                .end    = INNOKOM_SW_UPDATE_IRQ,                .flags  = IORESOURCE_IRQ,        },        [1] = {                .start  = INNOKOM_RESET_IRQ,                .end    = INNOKOM_RESET_IRQ,                .flags  = IORESOURCE_IRQ,        },};static struct platform_device innokom_switches_device = {	.name		= "innokom switches",	.id		= 1,	.num_resources	= ARRAY_SIZE(innokom_switches_resources),	.resource	= innokom_switches_resources,};static struct platform_device *devices[] __initdata = {	&smc91x_device,	&innokom_switches_device,};/* * Specific Board Initialisation */static int __init innokom_init(void){	/* init innokom irqs */	/* reset button */	if (request_irq(INNOKOM_RESET_IRQ, &reset_handler, 0, "reset button", NULL))		printk(KERN_INFO "innokom: can't get assigned irq %i\n (reset button)",INNOKOM_RESET_IRQ);	else		set_irq_type(INNOKOM_RESET_IRQ, INNOKOM_RESET_IRQ_EDGE);	/* sw update button */	if (request_irq(INNOKOM_SW_UPDATE_IRQ, &sw_update_handler, 0, "software update button", NULL))		printk(KERN_INFO "innokom: can't get assigned irq %i (sw update button)\n", INNOKOM_SW_UPDATE_IRQ);	else		set_irq_type(INNOKOM_SW_UPDATE_IRQ, INNOKOM_SW_UPDATE_IRQ_EDGE);	/* smc91111 ethernet irq *///	set_irq_type(INNOKOM_ETH_IRQ, INNOKOM_ETH_IRQ_EDGE);	/* USB disconnect irq *///	set_irq_type(INNOKOM_USB_DISC_IRQ, INNOKOM_USB_DISC_IRQ_EDGE);	/* add device entries */	return platform_add_devices(devices, ARRAY_SIZE(devices));}subsys_initcall(innokom_init);/* memory mapping */static struct map_desc innokom_io_desc[] __initdata = {/*  virtual           physical          length            type                           */  { INNOKOM_ETH_VIRT, INNOKOM_ETH_PHYS, INNOKOM_ETH_SIZE, MT_DEVICE }, /* ETH SMSC 91111 */};static void __init innokom_map_io(void){	pxa_map_io();	iotable_init(innokom_io_desc, ARRAY_SIZE(innokom_io_desc));	/* Enable the BTUART */	CKEN |= CKEN7_BTUART;	pxa_gpio_mode(GPIO42_BTRXD_MD);	pxa_gpio_mode(GPIO43_BTTXD_MD);	pxa_gpio_mode(GPIO44_BTCTS_MD);	pxa_gpio_mode(GPIO45_BTRTS_MD);	pxa_gpio_mode(GPIO33_nCS_5_MD);	/* SMSC network chip */	/* setup sleep mode values */	PWER  = 0x00000002;	PFER  = 0x00000000;	PRER  = 0x00000002;	PGSR0 = 0x00008000;	PGSR1 = 0x003F0202;	PGSR2 = 0x0001C000;	PCFR |= PCFR_OPDE;}/* FIXME: memory tags should be set correctly */static void __init innokom_fixup(struct machine_desc *desc, 				 struct tag *tag, 				 char **cmdline, struct meminfo *mi){	SET_BANK(0, 0xa0000000, (64*1024*1024));	mi->nr_banks = 1;}MACHINE_START(INNOKOM, "Auerswald Innokom")	MAINTAINER("Robert Schwebel, Pengutronix")	BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))	BOOT_PARAMS(0xa0000100)	FIXUP(innokom_fixup)	MAPIO(innokom_map_io)	INITIRQ(innokom_init_irq)MACHINE_END

⌨️ 快捷键说明

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