Exemplo n.º 1
0
/*!
 * pcd_func_int_hndlr_isr() - main pcd function interrupt handler
 * @param irq
 * @param dev_id
 * @param regs
 */
irqreturn_t pcd_func_int_hndlr_isr(int irq, void *dev_id)
{
        //pcd_instance->otg->interrupts++;
        //TRACE_MSG0(OCD, "--");
        //printk(KERN_INFO"%s:\n", __FUNCTION__);
        //TRACE_MSG1(OCD, "CLK: %08x", fs_rl(OTG_CORE_CLK_CTRL) );

        return mxc_pcd_int_hndlr();
}
Exemplo n.º 2
0
int
mxcusb_stream_read(char *buf,
                 int len,
                 int *err)
{
//    diag_printf("%s(len=%d buf=%x)\n", __FUNCTION__, len, buf);

	return mxc_pcd_int_hndlr(buf, len);
}
Exemplo n.º 3
0
/*!
 * ocd_ctrl_int_hndlr - Control and I2C interrupt
 * Process USBOTG related interrupts.
 * @param irq
 * @param dev_id
 * @param regs
 */
static irqreturn_t ocd_ctrl_int_hndlr(int irq, void *dev_id)
{
        u32 sys_ctrl = fs_rl(OTG_SYS_CTRL);            // C.f. 23.8 USB Control Register
        u32 cint_stat = fs_rl(OTG_CORE_CINT_STAT);     // C.f. 23.9.2 USBOTG Module Interrupt Status Register
        u32 hint_stat = fs_rl(OTG_CORE_HINT_STAT);     // C.f. 23.9.12 HNP Interrupt Status Register
        u32 hnp_cstat = fs_rl(OTG_CORE_HNP_CSTAT);

        static u32 ocd_interrupts = 0;

        /* N.B. OTG_CORE_CINT_STAT interrupts are self clearing when interrupt
         * sources have been cleared.
         */
        RETURN_IRQ_HANDLED_UNLESS(cint_stat || hint_stat);

        //if (sys_ctrl & (SYS_CTRL_HOST_WU_INT_STAT | SYS_CTRL_FNT_WU_INT_STAT))
        //        TRACE_MSG1(OCD, "SYS_CTRL: HOST/FUNC %08x", sys_ctrl);

        //TRACE_MSG4(OCD, "CLK: %08x sys: %08x cint: %08x hint: %08x", fs_rl(OTG_CORE_CLK_CTRL), sys_ctrl, cint_stat, hint_stat);


        if (hint_stat) {
                //if (hint_stat & HNP_I2COTGINT)
                //        TRACE_MSG1(OCD, "OTG_CORE_HINT_STAT HNP_I2COTGINT %08x ignored (periodic?)", hint_stat);

                fs_wl(OTG_CORE_HINT_STAT, hint_stat);
                printk(KERN_INFO"%s: HINT_STAT: %08x HNP_CSTAT: %08x\n", __FUNCTION__, hint_stat, hnp_cstat);
        }

        if (cint_stat & MODULE_ASHNPINT) {                              // asynchronous HNP interrupt, enable Main clock
                u32 hnp_cstat = fs_rl(OTG_CORE_HNP_CSTAT);
                u32 hint_stat = fs_rl(OTG_CORE_HINT_STAT);
                //TRACE_MSG1(OCD, "MODULE_ASHNPINT %08x", hint_stat);

                mxc_main_clock_on();                          // turn on Main Clock

                //if (hnp_cstat & MODULE_ISBDEV)
                //        TRACE_MSG0(OCD, "ISBDEV");

                //if (hnp_cstat & MODULE_ISADEV)
                //        TRACE_MSG0(OCD, "ISADEV");

                //fs_wl_set(OCD, OTG_CORE_HINT_STAT, hint_stat);
                fs_wl(OTG_CORE_HINT_STAT, hint_stat);
		ocd_hnp_int_hndlr(irq, dev_id);
        }
        if (cint_stat & MODULE_ASFCINT) {                               // Asynchronous Function interrupt, enable Func clock
                //TRACE_MSG1(OCD, "MODULE_ASFCINT %08x", cint_stat);
                // XXX otg_queue_event(ocd_instance->otg, B_SESS_VLD | A_SESS_VLD, PCD, "MX2ADS ASFCINT");
                mxc_func_clock_on();                                    // turn on Function Clock
        }

        if (cint_stat & MODULE_ASHCINT) {                               // Asynchronous Host interrupt, enable Host clock
                //TRACE_MSG1(OCD, "MODULE_ASHCINT %08x", cint_stat);
                mxc_host_clock_on();                         // turn on Host Clock
        }

        if ((cint_stat & MODULE_HNPINT) || hint_stat)                                  // HNP interrupt
		ocd_hnp_int_hndlr(irq, dev_id);

        if (cint_stat & MODULE_FCINT)
                mxc_pcd_int_hndlr();

        if (cint_stat & MODULE_HCINT) {
                //TRACE_MSG1(OCD, "MODULE_HCINT %08x", cint_stat);
		mxc_hcd_hw_int_hndlr(irq, NULL);
        }

        return IRQ_HANDLED;
}