Path: blob/master/arch/m32r/platforms/mappi2/setup.c
10818 views
/*1* linux/arch/m32r/platforms/mappi2/setup.c2*3* Setup routines for Renesas MAPPI-II(M3A-ZA36) Board4*5* Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,6* Hitoshi Yamamoto, Mamoru Sakugawa7*/89#include <linux/irq.h>10#include <linux/kernel.h>11#include <linux/init.h>12#include <linux/platform_device.h>1314#include <asm/system.h>15#include <asm/m32r.h>16#include <asm/io.h>1718#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))1920icu_data_t icu_data[NR_IRQS];2122static void disable_mappi2_irq(unsigned int irq)23{24unsigned long port, data;2526if ((irq == 0) ||(irq >= NR_IRQS)) {27printk("bad irq 0x%08x\n", irq);28return;29}30port = irq2port(irq);31data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;32outl(data, port);33}3435static void enable_mappi2_irq(unsigned int irq)36{37unsigned long port, data;3839if ((irq == 0) ||(irq >= NR_IRQS)) {40printk("bad irq 0x%08x\n", irq);41return;42}43port = irq2port(irq);44data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;45outl(data, port);46}4748static void mask_mappi2(struct irq_data *data)49{50disable_mappi2_irq(data->irq);51}5253static void unmask_mappi2(struct irq_data *data)54{55enable_mappi2_irq(data->irq);56}5758static void shutdown_mappi2(struct irq_data *data)59{60unsigned long port;6162port = irq2port(data->irq);63outl(M32R_ICUCR_ILEVEL7, port);64}6566static struct irq_chip mappi2_irq_type =67{68.name = "MAPPI2-IRQ",69.irq_shutdown = shutdown_mappi2,70.irq_mask = mask_mappi2,71.irq_unmask = unmask_mappi2,72};7374void __init init_IRQ(void)75{76#if defined(CONFIG_SMC91X)77/* INT0 : LAN controller (SMC91111) */78irq_set_chip_and_handler(M32R_IRQ_INT0, &mappi2_irq_type,79handle_level_irq);80icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;81disable_mappi2_irq(M32R_IRQ_INT0);82#endif /* CONFIG_SMC91X */8384/* MFT2 : system timer */85irq_set_chip_and_handler(M32R_IRQ_MFT2, &mappi2_irq_type,86handle_level_irq);87icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;88disable_mappi2_irq(M32R_IRQ_MFT2);8990#ifdef CONFIG_SERIAL_M32R_SIO91/* SIO0_R : uart receive data */92irq_set_chip_and_handler(M32R_IRQ_SIO0_R, &mappi2_irq_type,93handle_level_irq);94icu_data[M32R_IRQ_SIO0_R].icucr = 0;95disable_mappi2_irq(M32R_IRQ_SIO0_R);9697/* SIO0_S : uart send data */98irq_set_chip_and_handler(M32R_IRQ_SIO0_S, &mappi2_irq_type,99handle_level_irq);100icu_data[M32R_IRQ_SIO0_S].icucr = 0;101disable_mappi2_irq(M32R_IRQ_SIO0_S);102/* SIO1_R : uart receive data */103irq_set_chip_and_handler(M32R_IRQ_SIO1_R, &mappi2_irq_type,104handle_level_irq);105icu_data[M32R_IRQ_SIO1_R].icucr = 0;106disable_mappi2_irq(M32R_IRQ_SIO1_R);107108/* SIO1_S : uart send data */109irq_set_chip_and_handler(M32R_IRQ_SIO1_S, &mappi2_irq_type,110handle_level_irq);111icu_data[M32R_IRQ_SIO1_S].icucr = 0;112disable_mappi2_irq(M32R_IRQ_SIO1_S);113#endif /* CONFIG_M32R_USE_DBG_CONSOLE */114115#if defined(CONFIG_USB)116/* INT1 : USB Host controller interrupt */117irq_set_chip_and_handler(M32R_IRQ_INT1, &mappi2_irq_type,118handle_level_irq);119icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;120disable_mappi2_irq(M32R_IRQ_INT1);121#endif /* CONFIG_USB */122123/* ICUCR40: CFC IREQ */124irq_set_chip_and_handler(PLD_IRQ_CFIREQ, &mappi2_irq_type,125handle_level_irq);126icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;127disable_mappi2_irq(PLD_IRQ_CFIREQ);128129#if defined(CONFIG_M32R_CFC)130/* ICUCR41: CFC Insert */131irq_set_chip_and_handler(PLD_IRQ_CFC_INSERT, &mappi2_irq_type,132handle_level_irq);133icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;134disable_mappi2_irq(PLD_IRQ_CFC_INSERT);135136/* ICUCR42: CFC Eject */137irq_set_chip_and_handler(PLD_IRQ_CFC_EJECT, &mappi2_irq_type,138handle_level_irq);139icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;140disable_mappi2_irq(PLD_IRQ_CFC_EJECT);141#endif /* CONFIG_MAPPI2_CFC */142}143144#define LAN_IOSTART 0x300145#define LAN_IOEND 0x320146static struct resource smc91x_resources[] = {147[0] = {148.start = (LAN_IOSTART),149.end = (LAN_IOEND),150.flags = IORESOURCE_MEM,151},152[1] = {153.start = M32R_IRQ_INT0,154.end = M32R_IRQ_INT0,155.flags = IORESOURCE_IRQ,156}157};158159static struct platform_device smc91x_device = {160.name = "smc91x",161.id = 0,162.num_resources = ARRAY_SIZE(smc91x_resources),163.resource = smc91x_resources,164};165166static int __init platform_init(void)167{168platform_device_register(&smc91x_device);169return 0;170}171arch_initcall(platform_init);172173174