[U-Boot-Users] Interrupts in at91rm9200 u-boot.

Leonid Leonid at a-k-a.net
Wed Jul 11 19:08:43 CEST 2007


Hi:

I'm trying to implement simple USB device in u-boot for at91rm9200 and
as a first step I want to see that I can work with interrupts there. I
added temporary device initialization code to usb_lowlevel_init():

.............................
	AT91PS_AIC pAic = AT91C_BASE_AIC;

	*AT91C_PMC_SCER = AT91C_PMC_UDP;/* 48MHz clock enabled for UDP
*/
	*AT91C_PMC_PCER = (1 << AT91C_ID_UDP);	/* Peripheral Clock
Enable Register */

	pAic->AIC_IDCR = 1 << AT91C_ID_UDP;
	pAic->AIC_SVR[AT91C_ID_UDP] = (unsigned int) &dfu_udp_irq;
	pAic->AIC_SMR[AT91C_ID_UDP] =
AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE | 
				      1;
	pAic->AIC_ICCR = 1 << AT91C_ID_UDP;

	AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_UDP);
..............................................

BTW, I suspect that AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE is not correct
one actually in this case.

Interrupt handler just prints something, clears the interrupt and
leaves:

static void dfu_udp_irq(void)
{
	AT91PS_UDP pUDP = AT91C_BASE_UDP;
	AT91_REG isr = pUDP->UDP_ISR;
	AT91PS_AIC pAic = AT91C_BASE_AIC;
	static unsigned int counter=0;

	printf ("dfu_udp_irq:%u isr = 0x%X (AT91C_ID_UDP=%u) counter
%u\n", 
	  __LINE__, isr, AT91C_ID_UDP, counter++); 

	/* clear all interrupts */
	pUDP->UDP_ICR = isr;

	pAic->AIC_ICCR = AT91C_ID_UDP;
}

I issue "usb start" command and then connect my device port to external
USB host (I also can do the same, connecting it to card's own host
port). I get the interrupt, but system is dead after that - looks like
interrupt never gets freed:

U-Boot$ dfu_udp_irq:1554 isr = 0x300 (AT91C_ID_UDP=11) counter 0

Now, interrupt's bits that are set are RXSUSP (USB Suspend Interrupt
Status) and RXRSM (USB Resume Interrupt Status). I think my code clears
them, but may be I shall do something else provided that USB device is
in suspended mode now? Looks like the interrupt doesn't get released
after all...

Thanks,

Leonid.




More information about the U-Boot mailing list