diff mbox

[02/11] dmaengine: cppi41: Split out the interrupt handler

Message ID 20170109160656.3470-3-abailon@baylibre.com
State New
Headers show

Commit Message

Alexandre Bailon Jan. 9, 2017, 4:06 p.m. UTC
The current interrupt handler do some actions specifics to am335x.
These actions should be made by the platform interrupt handler.
Split out the interrupt handler in two:
one for the am335x platform and a generic one.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>

---
 drivers/dma/cppi41.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sergei Shtylyov Jan. 10, 2017, 5:39 p.m. UTC | #1
Hello.

On 01/09/2017 07:06 PM, Alexandre Bailon wrote:

> The current interrupt handler do some actions specifics to am335x.

> These actions should be made by the platform interrupt handler.

> Split out the interrupt handler in two:

> one for the am335x platform and a generic one.

>

> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>

> ---

>  drivers/dma/cppi41.c | 24 +++++++++++++++---------

>  1 file changed, 15 insertions(+), 9 deletions(-)

>

> diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c

> index 25ee71d..42744ed 100644

> --- a/drivers/dma/cppi41.c

> +++ b/drivers/dma/cppi41.c

> @@ -284,18 +284,11 @@ static u32 cppi41_pop_desc(struct cppi41_dd *cdd, unsigned queue_num)

>  	return desc;

>  }

>

> -static irqreturn_t cppi41_irq(int irq, void *data)

> +static irqreturn_t cppi41_irq(struct cppi41_dd *cdd)

>  {

> -	struct cppi41_dd *cdd = data;

>  	struct cppi41_channel *c;

> -	u32 status;

>  	int i;

>

> -	status = cppi_readl(cdd->usbss_mem + USBSS_IRQ_STATUS);

> -	if (!(status & USBSS_IRQ_PD_COMP))

> -		return IRQ_NONE;

> -	cppi_writel(status, cdd->usbss_mem + USBSS_IRQ_STATUS);

> -


    I fail to understand why non-CPPI 4.1 regs are used here (and that 
positioning itself as an "abstract" CPPI 4.1 driver).

[...]
> @@ -351,6 +344,19 @@ static irqreturn_t cppi41_irq(int irq, void *data)

>  	return IRQ_HANDLED;

>  }

>

> +static irqreturn_t am335x_cppi41_irq(int irq, void *data)

> +{

> +	struct cppi41_dd *cdd = data;

> +	u32 status;

> +

> +	status = cppi_readl(cdd->usbss_mem + USBSS_IRQ_STATUS);

> +	if (!(status & USBSS_IRQ_PD_COMP))

> +		return IRQ_NONE;

> +	cppi_writel(status, cdd->usbss_mem + USBSS_IRQ_STATUS);

> +

> +	return cppi41_irq(cdd);

> +}

> +


    IMHO this stuff just needs to move to the MUSB glue.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 25ee71d..42744ed 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -284,18 +284,11 @@  static u32 cppi41_pop_desc(struct cppi41_dd *cdd, unsigned queue_num)
 	return desc;
 }
 
-static irqreturn_t cppi41_irq(int irq, void *data)
+static irqreturn_t cppi41_irq(struct cppi41_dd *cdd)
 {
-	struct cppi41_dd *cdd = data;
 	struct cppi41_channel *c;
-	u32 status;
 	int i;
 
-	status = cppi_readl(cdd->usbss_mem + USBSS_IRQ_STATUS);
-	if (!(status & USBSS_IRQ_PD_COMP))
-		return IRQ_NONE;
-	cppi_writel(status, cdd->usbss_mem + USBSS_IRQ_STATUS);
-
 	for (i = QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE); i < QMGR_NUM_PEND;
 			i++) {
 		u32 val;
@@ -351,6 +344,19 @@  static irqreturn_t cppi41_irq(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t am335x_cppi41_irq(int irq, void *data)
+{
+	struct cppi41_dd *cdd = data;
+	u32 status;
+
+	status = cppi_readl(cdd->usbss_mem + USBSS_IRQ_STATUS);
+	if (!(status & USBSS_IRQ_PD_COMP))
+		return IRQ_NONE;
+	cppi_writel(status, cdd->usbss_mem + USBSS_IRQ_STATUS);
+
+	return cppi41_irq(cdd);
+}
+
 static dma_cookie_t cppi41_tx_submit(struct dma_async_tx_descriptor *tx)
 {
 	dma_cookie_t cookie;
@@ -949,7 +955,7 @@  static struct dma_chan *cppi41_dma_xlate(struct of_phandle_args *dma_spec,
 }
 
 static const struct cppi_glue_infos am335x_usb_infos = {
-	.isr = cppi41_irq,
+	.isr = am335x_cppi41_irq,
 	.queues_rx = am335x_usb_queues_rx,
 	.queues_tx = am335x_usb_queues_tx,
 	.td_queue = { .submit = 31, .complete = 0 },