示例#1
0
void mcf_autovector(unsigned int vec)
{
	volatile unsigned char  *mbar;
	unsigned char		icr;

	if ((vec >= 25) && (vec <= 31)) {
		vec -= 25;
		mbar = (volatile unsigned char *) MCF_MBAR;
		icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
		*(mbar + MCFSIM_ICR1 + vec) = icr;
		vec = 0x1 << (vec + 1);
		mcf_setimr(mcf_getimr() & ~vec);
	}
}
示例#2
0
文件: config.c 项目: 1x23/unifi-gpl
void mcf_settimericr(unsigned int timer, unsigned int level)
{
	volatile unsigned char *icrp;
	unsigned int icr, imr;

	if (timer <= 2) {
		switch (timer) {
		case 2:  icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
		default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
		}

		icrp = (volatile unsigned char *) (MCF_MBAR + icr);
		*icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
		mcf_setimr(mcf_getimr() & ~imr);
	}
}
示例#3
0
文件: config.c 项目: 1x23/unifi-gpl
void config_BSP(char *commandp, int size)
{
	mcf_setimr(MCFSIM_IMR_MASKALL);

#if defined(CONFIG_BOOTPARAM)
	strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
	commandp[size-1] = 0;
#else
	memset(commandp, 0, size);
#endif

	mach_sched_init = coldfire_timer_init;
	mach_tick = coldfire_tick;
	mach_gettimeoffset = coldfire_timer_offset;
	mach_trap_init = coldfire_trap_init;
	mach_reset = coldfire_reset;
}
示例#4
0
void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *))
{
	volatile unsigned short	*timerp;
	volatile unsigned char	*icrp;

	/* Set up TIMER 1 as poll clock */
	timerp = (volatile unsigned short *) (MCF_MBAR + MCFTIMER_BASE1);
	timerp[MCFTIMER_TMR] = MCFTIMER_TMR_DISABLE;

	timerp[MCFTIMER_TRR] = (unsigned short) ((MCF_CLK / 16) / HZ);
	timerp[MCFTIMER_TMR] = MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
		MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE;

	icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_TIMER1ICR);

	*icrp = MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL5 | MCFSIM_ICR_PRI3;
	request_irq(29, handler, SA_INTERRUPT, "ColdFire Timer", NULL);
	mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_TIMER1);
}
示例#5
0
void config_BSP(char *commandp, int size)
{
	mcf_setimr(MCFSIM_IMR_MASKALL);

#if defined(CONFIG_BOOTPARAM)
	strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
	commandp[size-1] = 0;
#elif defined(CONFIG_NETtel)
	/* Copy command line from FLASH to local buffer... */
	memcpy(commandp, (char *) 0xf0004000, size);
	commandp[size-1] = 0;
#else
	memset(commandp, 0, size);
#endif /* CONFIG_NETtel */

	mach_sched_init = coldfire_timer_init;
	mach_tick = coldfire_tick;
	mach_gettimeoffset = coldfire_timer_offset;
	mach_trap_init = coldfire_trap_init;
	mach_reset = coldfire_reset;
}
示例#6
0
void coldfire_profile_init(void)
{
	volatile unsigned short	*timerp;
	volatile unsigned char	*icrp;

	printk("PROFILE: lodging timer2=%d as profile timer\n", PROFILEHZ);

	/* Set up TIMER 2 as poll clock */
	timerp = (volatile unsigned short *) (MCF_MBAR + MCFTIMER_BASE2);
	timerp[MCFTIMER_TMR] = MCFTIMER_TMR_DISABLE;

	timerp[MCFTIMER_TRR] = (unsigned short) ((MCF_BUSCLK / 16) / PROFILEHZ);
	timerp[MCFTIMER_TMR] = MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
		MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE;

	icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_TIMER2ICR);

	*icrp = MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3;
	request_irq(31, coldfire_profile_tick, (SA_INTERRUPT | IRQ_FLG_FAST),
		"Profile Timer", NULL);
	mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_TIMER2);
}
示例#7
0
void coldfire_trap_init(void)
{
	int i;
#ifdef MCF_MEMORY_PROTECT
	extern unsigned long _end;
	extern unsigned long memory_end;
#endif

#ifndef ENABLE_dBUG
	mcf_setimr(MCFSIM_IMR_MASKALL);
#endif

	/*
	 *	There is a common trap handler and common interrupt
	 *	handler that handle almost every vector. We treat
	 *	the system call and bus error special, they get their
	 *	own first level handlers.
	 */
#ifndef ENABLE_dBUG
	for (i = 3; (i <= 23); i++)
		_ramvec[i] = trap;
	for (i = 33; (i <= 63); i++)
		_ramvec[i] = trap;
#endif

	for (i = 24; (i <= 30); i++)
		_ramvec[i] = inthandler;
#ifndef ENABLE_dBUG
	_ramvec[31] = inthandler;  // Disables the IRQ7 button
#endif

	for (i = 64; (i < 255); i++)
		_ramvec[i] = inthandler;
	_ramvec[255] = 0;

	_ramvec[2] = buserr;
	_ramvec[32] = system_call;
}
示例#8
0
void config_BSP(char *commandp, int size)
{
	mcf_setimr(MCFSIM_IMR_MASKALL);

#if defined(CONFIG_BOOTPARAM)
	strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
	commandp[size-1] = 0;
#else
	memset(commandp, 0, size);
#endif

#if defined(CONFIG_CLEOPATRA)
	/* Different timer setup - to prevent device clash */
	mcf_timervector = 30;
	mcf_profilevector = 31;
	mcf_timerlevel = 6;
#endif

	mach_sched_init = coldfire_timer_init;
	mach_tick = coldfire_tick;
	mach_gettimeoffset = coldfire_timer_offset;
	mach_trap_init = coldfire_trap_init;
	mach_reset = coldfire_reset;
}
示例#9
0
/*
 *	Process a watchdog timeout interrupt. For a normal clean watchdog
 *	we just do a process dump. For old broken 5307 we need to verify
 *	if this was a real watchdog event or not...
 */
void watchdog_timeout(int irq, void *dummy, struct pt_regs *fp)
{
#ifdef CONFIG_OLDMASK
	/*
	 *	Debuging code for software watchdog. If we get in here
	 *	and timer interrupt counts don't match we know that a
	 *	bad external bus cycle must have locked the CPU.
	 */
	if ((swt_doit++ > TIMEDELAY) &&
	    ((swt_lastjiffies + swt_reference) > jiffies)) {
		if (swt_inwatchdog) {
			cli();
			watchdog_disable();
			mcf_setimr(mcf_getimr() | MCFSIM_IMR_SWD);
			printk("%s(%d): Double WATCHDOG PANIC!!\n",
				__FILE__, __LINE__);
			for (;;)
				;
		}

		swt_inwatchdog++;
		swt_doit = TIMEDELAY - 8;	/* 8 seconds grace */
		printk("WATCHDOG: expired last=%d(%d) jiffies=%d!\n",
			swt_lastjiffies, swt_reference, jiffies);
		dump(fp);
		force_sig(SIGSEGV, current);
		swt_inwatchdog  = 0;
	}
	swt_lastjiffies = jiffies;
#else

	printk("WATCHDOG: expired!\n");
	dump(fp);

#endif /* CONFIG_OLDMASK */
}
示例#10
0
static void __inline__ mcf_ackvector(void)
{
	mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_EINT7);
}
示例#11
0
void __init config_BSP(char *commandp, int size)
{
	mcf_setimr(MCFSIM_IMR_MASKALL);
	mach_reset = m5206_cpu_reset;
}
示例#12
0
文件: intc.c 项目: CSCLOG/beaglebone
static void intc_irq_mask(struct irq_data *d)
{
	if (mcf_irq2imr[d->irq])
		mcf_setimr(mcf_irq2imr[d->irq]);
}
/*
 *	Based on the line number set up the internal interrupt stuff.
 */
static void mcfrs_irqinit(struct mcf_serial *info)
{
#if defined(CONFIG_M5272)
	volatile unsigned long	*icrp;
	volatile unsigned long	*portp;
	volatile unsigned char	*uartp;

	uartp = info->addr;
	icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR2);

	switch (info->line) {
	case 0:
		*icrp = 0xe0000000;
		break;
	case 1:
		*icrp = 0x0e000000;
		break;
	default:
		printk("MCFRS: don't know how to handle UART %d interrupt?\n",
			info->line);
		return;
	}

	/* Enable the output lines for the serial ports */
	portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PBCNT);
	*portp = (*portp & ~0x000000ff) | 0x00000055;
	portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PDCNT);
	*portp = (*portp & ~0x000003fc) | 0x000002a8;
#elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
	volatile unsigned char *icrp, *uartp;
	volatile unsigned long *imrp;

	uartp = info->addr;

	icrp = (volatile unsigned char *) (MCF_MBAR + MCFICM_INTC0 +
		MCFINTC_ICR0 + MCFINT_UART0 + info->line);
	*icrp = 0x30 + info->line; /* level 6, line based priority */

	imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 +
		MCFINTC_IMRL);
	*imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1);
#if defined(CONFIG_M527x)
	{
		/*
		 * External Pin Mask Setting & Enable External Pin for Interface
		 * [email protected]
        	 */
		u16 *serpin_enable_mask;
		serpin_enable_mask = (u16 *) (MCF_IPSBAR + MCF_GPIO_PAR_UART);
		if (info->line == 0)
			*serpin_enable_mask |= UART0_ENABLE_MASK;
		else if (info->line == 1)
			*serpin_enable_mask |= UART1_ENABLE_MASK;
		else if (info->line == 2)
			*serpin_enable_mask |= UART2_ENABLE_MASK;
	}
#endif
#if defined(CONFIG_M528x)
	/* make sure PUAPAR is set for UART0 and UART1 */
	if (info->line < 2) {
		volatile unsigned char *portp = (volatile unsigned char *) (MCF_MBAR + MCF5282_GPIO_PUAPAR);
		*portp |= (0x03 << (info->line * 2));
	}
#endif
#elif defined(CONFIG_M520x)
	volatile unsigned char *icrp, *uartp;
	volatile unsigned long *imrp;

	uartp = info->addr;

	icrp = (volatile unsigned char *) (MCF_MBAR + MCFICM_INTC0 +
		MCFINTC_ICR0 + MCFINT_UART0 + info->line);
	*icrp = 0x03;

	imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 +
		MCFINTC_IMRL);
	*imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1);
	if (info->line < 2) {
		unsigned short *uart_par;
		uart_par = (unsigned short *)(MCF_IPSBAR + MCF_GPIO_PAR_UART);
		if (info->line == 0)
			*uart_par |=  MCF_GPIO_PAR_UART_PAR_UTXD0
				  | MCF_GPIO_PAR_UART_PAR_URXD0;
		else if (info->line == 1)
			*uart_par |=  MCF_GPIO_PAR_UART_PAR_UTXD1
				  | MCF_GPIO_PAR_UART_PAR_URXD1;
		} else if (info->line == 2) {
			unsigned char *feci2c_par;
			feci2c_par = (unsigned char *)(MCF_IPSBAR +  MCF_GPIO_PAR_FECI2C);
			*feci2c_par &= ~0x0F;
			*feci2c_par |=  MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2
				    | MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
		}
#elif defined(CONFIG_M532x)
	volatile unsigned char *uartp;
	uartp = info->addr;
	switch (info->line) {
	case 0:
		MCF_INTC0_ICR26 = 0x3;
		MCF_INTC0_CIMR = 26;
		/* GPIO initialization */
		MCF_GPIO_PAR_UART |= 0x000F;
		break;
	case 1:
		MCF_INTC0_ICR27 = 0x3;
		MCF_INTC0_CIMR = 27;
		/* GPIO initialization */
		MCF_GPIO_PAR_UART |= 0x0FF0;
		break;
	case 2:
		MCF_INTC0_ICR28 = 0x3;
		MCF_INTC0_CIMR = 28;
		/* GPIOs also must be initalized, depends on board */
		break;
	}
#else
	volatile unsigned char	*icrp, *uartp;

	switch (info->line) {
	case 0:
		icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_UART1ICR);
		*icrp = /*MCFSIM_ICR_AUTOVEC |*/ MCFSIM_ICR_LEVEL6 |
			MCFSIM_ICR_PRI1;
		mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
		break;
	case 1:
		icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_UART2ICR);
		*icrp = /*MCFSIM_ICR_AUTOVEC |*/ MCFSIM_ICR_LEVEL6 |
			MCFSIM_ICR_PRI2;
		mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
		break;
	default:
		printk("MCFRS: don't know how to handle UART %d interrupt?\n",
			info->line);
		return;
	}

	uartp = info->addr;
	uartp[MCFUART_UIVR] = info->irq;
#endif

	/* Clear mask, so no surprise interrupts. */
	uartp[MCFUART_UIMR] = 0;

	if (request_irq(info->irq, mcfrs_interrupt, IRQF_DISABLED,
	    "ColdFire UART", NULL)) {
		printk("MCFRS: Unable to attach ColdFire UART %d interrupt "
			"vector=%d\n", info->line, info->irq);
	}

	return;
}
示例#14
0
static void __inline__ mcf_disablevec(void)
{
	mcf_setimr(mcf_getimr() | MCFSIM_IMR_EINT7);
}
示例#15
0
void m5249audio_init(void)
{
	printk("M5249AUDIO: (C) Copyright 2002, "
		"Greg Ungerer ([email protected])\n");

	if (register_chrdev(SOUND_MAJOR, "sound", &m5249audio_fops) < 0) {
		printk(KERN_WARNING "SOUND: failed to register major %d\n",
			SOUND_MAJOR);
		return;
	}

	m5249audio_buf = kmalloc(BUFSIZE, GFP_KERNEL);
	if (m5249audio_buf == NULL) {
		printk("M5249AUDIO: failed to allocate DMA[%d] buffer\n",
			BUFSIZE);
	}

#ifdef CONFIG_AUDIOIRQ
#ifdef CONFIG_AUDIOIRQASM
	/* Install fast interrupt handler */
	printk("M5249AUDIO: fast interrupt handler irq=%d\n",
		M5249AUDIO_TXIRQ);
	*((unsigned long *) (M5249AUDIO_TXIRQ * 4)) =
		(unsigned long) m5249audio_isr;
#else
	/* Re-direct TX empty FIFO audio interrupt. */
	printk("M5249AUDIO: standard interrupt handler, irq=%d\n",
		M5249AUDIO_TXIRQ);
	if (request_irq(M5249AUDIO_TXIRQ, m5249audio_isr,
	    (SA_INTERRUPT | IRQ_FLG_FAST), "audio", NULL)) {
		printk("M5249AUDIO: IRQ %d already in use?\n",
			M5249AUDIO_TXIRQ);
	}
#endif
	*reg32p(0x140) = 0x00007000;
#endif
#ifdef CONFIG_AUDIODMA
{
	volatile unsigned char *dmap;
	unsigned int		icr;

	printk("M5249AUDIO: DMA channel=%d, irq=%d\n",
		M5249AUDIO_DMA, M5249AUDIO_DMAIRQ);
	if (request_irq(M5249AUDIO_DMAIRQ, m5249audio_dmaisr,
	    (SA_INTERRUPT | IRQ_FLG_FAST), "audio(DMA)", NULL)) {
		printk("M5249AUDIO: DMA IRQ %d already in use?\n", 
			M5249AUDIO_DMAIRQ);
	}

	dmap = (volatile unsigned char *) dma_base_addr[M5249AUDIO_DMA];
	dmap[MCFDMA_DIVR] = M5249AUDIO_DMAIRQ;

	/* Set interrupt level and priority */
	switch (M5249AUDIO_DMA) {
	case 1:  icr=MCFSIM_DMA1ICR; m5249audio_imrbit=MCFSIM_IMR_DMA1; break;
	case 2:  icr=MCFSIM_DMA2ICR; m5249audio_imrbit=MCFSIM_IMR_DMA2; break;
	case 3:  icr=MCFSIM_DMA3ICR; m5249audio_imrbit=MCFSIM_IMR_DMA3; break;
	default: icr=MCFSIM_DMA0ICR; m5249audio_imrbit=MCFSIM_IMR_DMA0; break;
	}

	*simp(icr) = MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3;
	mcf_setimr(mcf_getimr() & ~m5249audio_imrbit);

	/* Set DMA to use channel 0 for audio */
	*reg8p(MCFA_DMACONF) = MCFA_DMA_0REQ;
	*reg32p(MCFSIM2_DMAROUTE) = 0x00000080;

	if (request_dma(M5249AUDIO_DMA, "audio")) {
		printk("M5249AUDIO: DMA channel %d already in use?\n",
			M5249AUDIO_DMA);
	}
}
#endif

	/* Unmute the DAC, set GPIO49 */
	*reg32p(MCFSIM2_GPIO1FUNC) |= 0x00020000;
	*reg32p(MCFSIM2_GPIO1ENABLE) |= 0x00020000;
	m5249audio_unmute();

	/* Power up the DAC, set GPIO39 */
	*reg32p(MCFSIM2_GPIO1FUNC) |= 0x00000080;
	*reg32p(MCFSIM2_GPIO1ENABLE) |= 0x00000080;
	*reg32p(MCFSIM2_GPIO1WRITE) |= 0x00000080;

	m5249audio_chipinit();

	/* Dummy write to start outputing */
	*reg32p(MCFA_PDOR3) = 0;
}
示例#16
0
void coldfire_trap_init(void)
{
	int i;
#ifdef MCF_MEMORY_PROTECT
	extern unsigned long _end;
	extern unsigned long memory_end;
#endif

#ifndef ENABLE_dBUG
	mcf_setimr(MCFSIM_IMR_MASKALL);
#endif

	/*
	 *	There is a common trap handler and common interrupt
	 *	handler that handle almost every vector. We treat
	 *	the system call and bus error special, they get their
	 *	own first level handlers.
	 */
#ifndef ENABLE_dBUG
	for (i = 3; (i <= 23); i++)
		_ramvec[i] = trap;
	for (i = 33; (i <= 63); i++)
		_ramvec[i] = trap;
#endif
#ifdef TRAP_DBG_INTERRUPT
	_ramvec[12] = dbginterrupt;
#endif

	for (i = 24; (i <= 30); i++)
		_ramvec[i] = intrhandler;
#ifndef ENABLE_dBUG
	_ramvec[31] = intrhandler;  // Disables the IRQ7 button
#endif

	for (i = 64; (i < 255); i++)
		_ramvec[i] = intrhandler;
	_ramvec[255] = 0;

	_ramvec[2] = buserr;
	_ramvec[32] = system_call;
	
#ifdef MCF_MEMORY_PROTECT
	/* In order to protect memory, we set up an address range breakpoint
	 * that starts from address 0 and go until the end of the kernel image
	 * plus data.  This doens't protect the kernel stack, hardware devices
	 * or user processes from each other but it is better than nothing.
	 */
	wdebug(MCFDEBUG_ABLR, &_end);		/* Start of range */
	wdebug(MCFDEBUG_ABHR, memory_end);	/* End of range */
	
	/* Now set the trigger register:
	 * Ignore RW bit, ignore size field, only user mode accesses
	 */
	wdebug(MCFDEBUG_AATR, 0xe300);
	
	/* Activate the break point as a level one trigger outside address range */
	wdebug(MCFDEBUG_TDR,
			MCFDEBUG_TDR_TRC_INTR | MCFDEBUG_TDR_LXT1 |
			MCFDEBUG_TDR_EBL1 | MCFDEBUG_TDR_EAI1);
	printk("Protected memory outside %#x to %#x\n", (int)&_end, (int)memory_end);
#endif
#ifdef MCF_BDM_DISABLE
	/* Disable the BDM clocking.  This also turns off most of the rest of
	 * the BDM device.  This is good for EMC reasons.  This option is not
	 * incompatible with the memory protection option.
	 */
	wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);
#endif
}
示例#17
0
static int init_port(void)
{
	unsigned long flags;

        /* Check io region*/
	
#ifdef LIRC_PORT
        if((check_region(port,8))==-EBUSY)
	{
#if 0
		/* this is the correct behaviour but many people have
                   the serial driver compiled into the kernel... */
		printk(KERN_ERR  LIRC_DRIVER_NAME  
		       ": port %04x already in use\n", port);
		return(-EBUSY);
#else
		printk(KERN_ERR LIRC_DRIVER_NAME  
		       ": port %04x already in use, proceding anyway\n", port);
		printk(KERN_WARNING LIRC_DRIVER_NAME  
		       ": compile the serial port driver as module and\n");
		printk(KERN_WARNING LIRC_DRIVER_NAME  
		       ": make sure this module is loaded first\n");
		release_region(port,8);
#endif
	}
	
	/* Reserve io region. */
	request_region(port, 8, LIRC_DRIVER_NAME);
#endif
	
	save_flags(flags);cli();

#ifndef CONFIG_COLDFIRE
	/* Set DLAB 0. */
	soutp(UART_LCR, sinp(UART_LCR) & (~UART_LCR_DLAB));
	
	/* First of all, disable all interrupts */
	soutp(UART_IER, sinp(UART_IER)&
	      (~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI)));
	
	/* Clear registers. */
	sinp(UART_LSR);
	sinp(UART_RX);
	sinp(UART_IIR);
	sinp(UART_MSR);
	
	/* Set line for power source */
	soutp(UART_MCR, LIRC_OFF);
	
	/* Clear registers again to be sure. */
	sinp(UART_LSR);
	sinp(UART_RX);
	sinp(UART_IIR);
	sinp(UART_MSR);

#ifdef LIRC_SERIAL_IRDEO
	/* setup port to 7N1 @ 115200 Baud */
	/* 7N1+start = 9 bits at 115200 ~ 3 bits at 38kHz */

	/* Set DLAB 1. */
	soutp(UART_LCR, sinp(UART_LCR) | UART_LCR_DLAB);
	/* Set divisor to 1 => 115200 Baud */
	soutp(UART_DLM,0);
	soutp(UART_DLL,1);
	/* Set DLAB 0 +  7N1 */
	soutp(UART_LCR,UART_LCR_WLEN7);
	/* THR interrupt already disabled at this point */
#endif

#else /* CONFIG_COLDFIRE */
{
	volatile unsigned char	*uartp;
#ifdef CONFIG_M5272
	volatile unsigned long	*icrp;
#else
	volatile unsigned char	*icrp;
#endif

/*
 *	we need a fast timer
 */
	coldfire_fast_init();
/*
 *	Setup the interrupts
 */
#ifdef CONFIG_M5272
#ifndef LIRC_PORT
	/* nothing to do */
#else
	icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR2);
	switch (LIRC_PORT) {
	case MCFUART_BASE1:
		*icrp = 0xe0000000;
		break;
	case MCFUART_BASE2:
		*icrp = 0x0e000000;
		break;
	default:
		printk("SERIAL: don't know how to handle UART %d interrupt?\n",
			LIRC_PORT;
		return;
	}
#endif
#else
	switch (LIRC_PORT) {
	case MCFUART_BASE1:
		icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_UART1ICR);
		*icrp = /*MCFSIM_ICR_AUTOVEC |*/ MCFSIM_ICR_LEVEL6 |
			MCFSIM_ICR_PRI1;
		mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
		break;
	case MCFUART_BASE2:
		icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_UART2ICR);
		*icrp = /*MCFSIM_ICR_AUTOVEC |*/ MCFSIM_ICR_LEVEL6 |
			MCFSIM_ICR_PRI2;
		mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
		break;
	default:
		printk("SERIAL: don't know how to handle UART %d interrupt?\n",
			LIRC_PORT);
		return(-EIO);
	}

	soutp(MCFUART_UIVR, LIRC_IRQ);
#endif

#ifdef LIRC_PORT
	/*
	 *	disable all interrupts
	 */
	soutp(MCFUART_UIMR, 0);
	soutp(MCFUART_UCR, MCFUART_UCR_CMDRESETRX);  /* reset RX */
	soutp(MCFUART_UCR, MCFUART_UCR_CMDRESETTX);  /* reset TX */
	soutp(MCFUART_UCR, MCFUART_UCR_CMDRESETMRPTR);  /* reset MR pointer */
	/*
	 * Set port for defined baud , 8 data bits, 1 stop bit, no parity.
	 */
	soutp(MCFUART_UMR, MCFUART_MR1_PARITYNONE | MCFUART_MR1_CS8);
	soutp(MCFUART_UMR, MCFUART_MR2_STOP1);

#define	clk ((MCF_CLK / 32) / 115200)
	soutp(MCFUART_UBG1, (clk & 0xff00) >> 8);  /* set msb baud */
	soutp(MCFUART_UBG2, (clk & 0xff));  /* set lsb baud */
#undef clk

	soutp(MCFUART_UCSR, MCFUART_UCSR_RXCLKTIMER | MCFUART_UCSR_TXCLKTIMER);
	soutp(MCFUART_UCR, 0 /* MCFUART_UCR_RXENABLE */);
	/*
	 *	Allow COS interrupts
	 */
	soutp(MCFUART_UACR, MCFUART_UACR_IEC);
	/*
	 *	turn on RTS for power
	 */
	soutp(MCFUART_UOP1, MCFUART_UOP_RTS);
#endif /* LIRC_PORT */
}
#endif /* CONFIG_COLDFIRE */
	
	restore_flags(flags);
	
	/* If pin is high, then this must be an active low receiver. */
	if(sense==-1)
	{
#if DAVIDM
		/* wait 1 sec for the power supply */
		
#               ifdef KERNEL_2_1
		sleep_on_timeout(&power_supply_queue,HZ);
#               else
		init_timer(&power_supply_timer);
		power_supply_timer.expires=jiffies+HZ;
		power_supply_timer.data=(unsigned long) current;
		power_supply_timer.function=power_supply_up;
		add_timer(&power_supply_timer);
		sleep_on(&power_supply_queue);
		del_timer(&power_supply_timer);
#               endif
		
#ifndef LIRC_PORT
		sense=(pin_status & LIRC_SIGNAL_PIN) ? 1:0;
#else
		sense=(sinp(UART_MSR) & LIRC_SIGNAL_PIN) ? 1:0;
#endif
#else
		sense = 0;
#endif /* DAVIDM */
		printk(KERN_INFO  LIRC_DRIVER_NAME  ": auto-detected active "
		       "%s receiver\n",sense ? "low":"high");
	}
	else
	{
		printk(KERN_INFO  LIRC_DRIVER_NAME  ": Manually using active "
		       "%s receiver\n",sense ? "low":"high");
	};
	
	return 0;
}
示例#18
0
void config_BSP(char *commandp, int size)
{
	mcf_setimr(MCFSIM_IMR_MASKALL);
	mach_reset = coldfire_reset;
}