Subject: Re: [PATCH] net: phy: Support for non-HW interrupt devices

From: Andrew Lunn <[email-masked]>
Date: Fri, 8 Jan 2016 16:51:11 +0100

> As you may already know, USB Interrupt Pipe is not actual interrupt and
> USB driver is beyond USB Host driver which deals with HW interrupt directly over
> request_irq(). So even we can put some code in USB Host driver to interface with 
> PHYLIB, it is more likely adding another USB stack to handle this pseudo interrupt.
> I don't think it's good approach to solve this problem.

You don't need any code in the USB irq handler.

I'm not too familiar with USB networking, but looking at usbnet.c, it
looks like intr_complete() gets called when there is a USB Interrupt
Pipe event. That calls into the drivers status() method.

In this status method, you need to trigger a Linux interrupt. By that,
i mean you need to call handle_nested_irq().

What i found useful was looking at how drivers/gpio/gpip-pca953x.c
works. That is an i2c GPIO expander, which supports GPIO
interrupts. When the device indicates an interrupt event, you need to
read an i2c register on the device to see which GPIO line has
triggered it, and then call handle_nestd_irq() for the corresponding
interrupt.

Humm, in fact, take a look at drivers/gpio/gpio-dln2.c It is a USB
GPIO expander, with interrupt support.

	Andrew