示例#1
0
/* Really do USB detection */
static int do_usb_detect(struct uh_data *uh)
{
	int rv;

	D("Called.\n");

	__intc_mask_irq(IRQ_OTG);

	/* Now enable PHY to start detect */
	__cpm_enable_otg_phy();

	/* Clear IRQs */
	REG16(USB_REG_INTRINE) = 0;
	REG16(USB_REG_INTROUTE) = 0;
	REG8(USB_REG_INTRUSBE) = 0;

	/* disable UDC IRQs first */
	REG16(USB_REG_INTRINE) = 0;
	REG16(USB_REG_INTROUTE) = 0;
	REG8(USB_REG_INTRUSBE) = 0;

	/* Disable DMA */
	REG32(USB_REG_CNTL1) = 0;
	REG32(USB_REG_CNTL2) = 0;

	/* Enable HS Mode */
	REG8(USB_REG_POWER) |= USB_POWER_HSENAB;
	/* Enable soft connect */
	REG8(USB_REG_POWER) |= USB_POWER_SOFTCONN;

	rv = usb_is_active();

	/* Detect finish ,clean every thing */
	/* Disconnect from usb */
	REG8(USB_REG_POWER) &= ~USB_POWER_SOFTCONN;
	
	/* Disable the USB PHY */
	__cpm_suspend_otg_phy();

	/* Clear IRQs */
	REG16(USB_REG_INTRINE) = 0;
	REG16(USB_REG_INTROUTE) = 0;
	REG8(USB_REG_INTRUSBE) = 0;

	__intc_ack_irq(IRQ_OTG);
	__intc_unmask_irq(IRQ_OTG);

	return rv;
}
示例#2
0
static void mask_and_ack_dma_irq(unsigned int irq)
{
	unsigned int intc_irq;

	if ( irq < (IRQ_DMA_0 + HALF_DMA_NUM) ) 	/* DMAC Group 0 irq */
		intc_irq = IRQ_DMAC0;
	else if ( irq < (IRQ_DMA_0 + MAX_DMA_NUM) ) 	/* DMAC Group 1 irq */
		intc_irq = IRQ_DMAC1;
	else {
		printk("%s, unexpected dma irq #%d\n", __FILE__, irq);
		return ;
	}
	__intc_ack_irq(intc_irq);
	__dmac_channel_ack_irq(irq-IRQ_DMA_0); /* needed?? add 20080506, Wolfgang */
	__dmac_channel_disable_irq(irq - IRQ_DMA_0);
}
示例#3
0
static void MMCGpioTask(void *arg)
{
	u8 err;
	cardstate = CARD_OUT;
	cardexsit = 1 ;
	while(1)
	{
//		__intc_mask_irq(48 + MMC_CD_PIN);
		printf("Looks like MMC gpio change! \n");
		if ( cardstate == CARD_OUT )     //card have inserted!
		{
			OSTimeDlyHMSM(0,0,0,500);
			if ( __gpio_get_pin(MMC_CD_PIN) == 0 ) //card readlly insert!
			{
				printf("Card readlly insert! \n");
				cardstate = CARD_IN;
				info_card_in();
				MMC_Initialize();
				__gpio_as_irq_rise_edge(MMC_CD_PIN);
			}
			else
				__gpio_as_irq_fall_edge(MMC_CD_PIN);
		}
		else                            //card have not inserted!
		{
			OSTimeDlyHMSM(0,0,0,500);
			if ( __gpio_get_pin(MMC_CD_PIN) == 1 ) //card readlly out!
			{
				printf("Card readlly out! \n");
				cardstate = CARD_OUT;
				info_card_out();
				__gpio_as_irq_fall_edge(MMC_CD_PIN);
			}
			else
				__gpio_as_irq_rise_edge(MMC_CD_PIN);

		}
		__gpio_ack_irq(MMC_CD_PIN);
		__intc_ack_irq(48 + MMC_CD_PIN);
		__gpio_unmask_irq(MMC_CD_PIN);
		OSSemPend(MMCGPIOEvent, 0, &err);
	}
}
示例#4
0
static void mask_and_ack_intc_irq(unsigned int irq)
{
	__intc_mask_irq(irq);
	__intc_ack_irq(irq);
}
示例#5
0
static void mask_and_ack_dma_irq(unsigned int irq)
{
	__intc_ack_irq(IRQ_DMAC);
	__dmac_channel_disable_irq(irq - IRQ_DMA_0);
}