コード例 #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_intc_irq(unsigned int irq)
{
	__intc_mask_irq(irq);
	__intc_ack_irq(irq);
}
コード例 #3
0
static void disable_intc_irq(unsigned int irq)
{
	__intc_mask_irq(irq);
}