From patchwork Fri Oct 25 11:47:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11212117 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12A9014E5 for ; Fri, 25 Oct 2019 11:47:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E494921D71 for ; Fri, 25 Oct 2019 11:47:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="xWaoweqj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502144AbfJYLrW (ORCPT ); Fri, 25 Oct 2019 07:47:22 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:55856 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439558AbfJYLrW (ORCPT ); Fri, 25 Oct 2019 07:47:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1572004038; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=ubXBlNXgZ6dgqOW4Rvu0/u058vZHZ0i/XTRKTfZTmIg=; b=xWaoweqjeqDxTfSzfmCzWoTt9opmIyLO68cwguDeU3uxoz+095dFkhKnEHjdGrvt2a7lPQ AvxKqeEecleRSXBN2k0ILe9+IB/syhkNtEFRKhYSgl08KWomOiBEXapeWAmALX32jpfBnn EP0iBFLQorg0RJvKpjFb1LHzBJRRnAI= From: Paul Cercueil To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil , Artur Rojek Subject: [PATCH v2 1/6] usb: musb: dma: Correct parameter passed to IRQ handler Date: Fri, 25 Oct 2019 13:47:05 +0200 Message-Id: <20191025114710.13222-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The IRQ handler was passed a pointer to a struct dma_controller, but the argument was then casted to a pointer to a struct musb_dma_controller. Signed-off-by: Paul Cercueil Tested-by: Artur Rojek --- Notes: v2: Rebase on 4.5-rc4 drivers/usb/musb/musbhsdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 5fc6825745f2..2d3751d885b4 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -425,7 +425,7 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, controller->controller.channel_abort = dma_channel_abort; if (request_irq(irq, dma_controller_irq, 0, - dev_name(musb->controller), &controller->controller)) { + dev_name(musb->controller), controller)) { dev_err(dev, "request_irq %d failed!\n", irq); musb_dma_controller_destroy(&controller->controller); From patchwork Fri Oct 25 11:47:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11212119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65E4614E5 for ; Fri, 25 Oct 2019 11:47:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 44D5621D82 for ; Fri, 25 Oct 2019 11:47:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="QPWCgX3i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502329AbfJYLra (ORCPT ); Fri, 25 Oct 2019 07:47:30 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:55926 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439621AbfJYLra (ORCPT ); Fri, 25 Oct 2019 07:47:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1572004039; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rkw9Sfx5EpcVJuLuKvY75aB7yGbnoPHOHTcgANtJznE=; b=QPWCgX3iw4UewQVozHd34uLTlbo/tFebZRvZTF+CW0nSLHHIDu8SYrM4GgJE5lRMw9eGP1 YKm7/w4Eg2Lz4T2VzWS8ZUP9WSYtEI28BRACu3SlcHPXby1AnC9nD4C2zzNb4KcIClD8CO v70FjsLxKvx05aeI/3qm285bRZdh2Lk= From: Paul Cercueil To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil , Artur Rojek Subject: [PATCH v2 2/6] usb: musb: dma: Add support for shared IRQ Date: Fri, 25 Oct 2019 13:47:06 +0200 Message-Id: <20191025114710.13222-2-paul@crapouillou.net> In-Reply-To: <20191025114710.13222-1-paul@crapouillou.net> References: <20191025114710.13222-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The implementation of the Inventra IP in some of the Ingenic JZ47xx SoCs does not use a separate IRQ line for DMA transfers. Allow these SoCs to be supported by adding a flag 'dma_share_usb_irq' in the struct musb. If set, no extra IRQ line is required, and the musb glue will need to call the API function musbhs_dma_controller_irq() within its interrupt handler. Signed-off-by: Paul Cercueil Tested-by: Artur Rojek --- Notes: v2: Rebase on 4.5-rc4 drivers/usb/musb/musb_core.h | 2 ++ drivers/usb/musb/musb_dma.h | 1 + drivers/usb/musb/musbhsdma.c | 27 ++++++++++++++++++++++----- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 04203b7126d5..b7c31c717800 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -392,6 +392,8 @@ struct musb { unsigned flush_irq_work:1; + unsigned dma_share_usb_irq:1; + u8 address; u8 test_mode_nr; u16 ackpend; /* ep0 */ diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h index 8f60271c0a9d..b3f65016a972 100644 --- a/drivers/usb/musb/musb_dma.h +++ b/drivers/usb/musb/musb_dma.h @@ -191,6 +191,7 @@ extern void (*musb_dma_controller_destroy)(struct dma_controller *); extern struct dma_controller * musbhs_dma_controller_create(struct musb *musb, void __iomem *base); extern void musbhs_dma_controller_destroy(struct dma_controller *c); +extern irqreturn_t musbhs_dma_controller_irq(struct dma_controller *c); extern struct dma_controller * tusb_dma_controller_create(struct musb *musb, void __iomem *base); diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 2d3751d885b4..898856e9974e 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -268,7 +268,7 @@ static int dma_channel_abort(struct dma_channel *channel) return 0; } -static irqreturn_t dma_controller_irq(int irq, void *private_data) +static irqreturn_t dma_controller_irq_cb(int irq, void *private_data) { struct musb_dma_controller *controller = private_data; struct musb *musb = controller->private_data; @@ -292,6 +292,9 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) int_hsdma = musb_readb(mbase, MUSB_HSDMA_INTR); if (!int_hsdma) { + if (musb->dma_share_usb_irq) + goto done; + musb_dbg(musb, "spurious DMA irq"); for (bchannel = 0; bchannel < MUSB_HSDMA_CHANNELS; bchannel++) { @@ -384,6 +387,15 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) return retval; } +irqreturn_t musbhs_dma_controller_irq(struct dma_controller *c) +{ + struct musb_dma_controller *controller = container_of(c, + struct musb_dma_controller, controller); + + return dma_controller_irq_cb(controller->irq, controller); +} +EXPORT_SYMBOL_GPL(musbhs_dma_controller_irq); + void musbhs_dma_controller_destroy(struct dma_controller *c) { struct musb_dma_controller *controller = container_of(c, @@ -404,9 +416,14 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, struct musb_dma_controller *controller; struct device *dev = musb->controller; struct platform_device *pdev = to_platform_device(dev); - int irq = platform_get_irq_byname(pdev, "dma"); + int irq; + + if (musb->dma_share_usb_irq) + irq = 0; + else + irq = platform_get_irq_byname(pdev, "dma"); - if (irq <= 0) { + if (irq < 0) { dev_err(dev, "No DMA interrupt line!\n"); return NULL; } @@ -424,8 +441,8 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, controller->controller.channel_program = dma_channel_program; controller->controller.channel_abort = dma_channel_abort; - if (request_irq(irq, dma_controller_irq, 0, - dev_name(musb->controller), controller)) { + if (irq > 0 && request_irq(irq, dma_controller_irq_cb, 0, + dev_name(musb->controller), controller)) { dev_err(dev, "request_irq %d failed!\n", irq); musb_dma_controller_destroy(&controller->controller); From patchwork Fri Oct 25 11:47:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11212121 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4903D14E5 for ; Fri, 25 Oct 2019 11:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2824121D71 for ; Fri, 25 Oct 2019 11:47:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="B02mlFO5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503440AbfJYLri (ORCPT ); Fri, 25 Oct 2019 07:47:38 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:56260 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502216AbfJYLrh (ORCPT ); Fri, 25 Oct 2019 07:47:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1572004040; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1LZRPjTaNqgAPsZFTi/ag+L9T2zf0Gi9U0ItR3Ud6R4=; b=B02mlFO54gTbqc/s+dk8ch5UrJ8fvqLpEOWRuzlscmxYYz8vKQUqE5IVUW9H41OryJlH8Y x8c6Asu3Br0KUl4v/7k0gksf8XUiXRmaGXgD4spbBHx1zXlRqwMc4e97/zxu7ywVc7ICew kRS/NHVYaX8/5JJ3xw1VFXsQBuNVeAw= From: Paul Cercueil To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil , Artur Rojek Subject: [PATCH v2 3/6] usb: musb: jz4740: Add support for DMA Date: Fri, 25 Oct 2019 13:47:07 +0200 Message-Id: <20191025114710.13222-3-paul@crapouillou.net> In-Reply-To: <20191025114710.13222-1-paul@crapouillou.net> References: <20191025114710.13222-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add support for using the DMA channels built into the Inventra IP. Signed-off-by: Paul Cercueil Tested-by: Artur Rojek --- Notes: v2: Rebase on 4.5-rc4 drivers/usb/musb/Kconfig | 2 +- drivers/usb/musb/jz4740.c | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 52f8e2b57ad5..210e4844c92a 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -142,7 +142,7 @@ config USB_UX500_DMA config USB_INVENTRA_DMA bool 'Inventra' - depends on USB_MUSB_OMAP2PLUS + depends on USB_MUSB_OMAP2PLUS || USB_MUSB_JZ4740 help Enable DMA transfers using Mentor's engine. diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index 5261f8dfedec..bbecfdee6ea1 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -25,11 +25,14 @@ struct jz4740_glue { static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) { unsigned long flags; - irqreturn_t retval = IRQ_NONE; + irqreturn_t retval = IRQ_NONE, retval_dma = IRQ_NONE; struct musb *musb = __hci; spin_lock_irqsave(&musb->lock, flags); + if (IS_ENABLED(CONFIG_USB_INVENTRA_DMA) && musb->dma_controller) + retval_dma = musbhs_dma_controller_irq(musb->dma_controller); + musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); @@ -47,7 +50,10 @@ static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) spin_unlock_irqrestore(&musb->lock, flags); - return retval; + if (retval == IRQ_HANDLED || retval_dma == IRQ_HANDLED) + return IRQ_HANDLED; + + return IRQ_NONE; } static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = { @@ -91,18 +97,19 @@ static int jz4740_musb_init(struct musb *musb) musb->dyn_fifo = true; musb->isr = jz4740_musb_interrupt; + musb->dma_share_usb_irq = true; return 0; } -/* - * DMA has not been confirmed to work with CONFIG_USB_INVENTRA_DMA, - * so let's not set up the dma function pointers yet. - */ static const struct musb_platform_ops jz4740_musb_ops = { .quirks = MUSB_DMA_INVENTRA | MUSB_INDEXED_EP, .fifo_mode = 2, .init = jz4740_musb_init, +#ifdef CONFIG_USB_INVENTRA_DMA + .dma_init = musbhs_dma_controller_create, + .dma_exit = musbhs_dma_controller_destroy, +#endif }; static int jz4740_probe(struct platform_device *pdev) @@ -137,6 +144,8 @@ static int jz4740_probe(struct platform_device *pdev) } musb->dev.parent = &pdev->dev; + musb->dev.dma_mask = &musb->dev.coherent_dma_mask; + musb->dev.coherent_dma_mask = DMA_BIT_MASK(32); glue->dev = &pdev->dev; glue->musb = musb; From patchwork Fri Oct 25 11:47:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11212123 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0917E14E5 for ; Fri, 25 Oct 2019 11:47:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB6F621D82 for ; Fri, 25 Oct 2019 11:47:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="HOt8Ncx2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503736AbfJYLrp (ORCPT ); Fri, 25 Oct 2019 07:47:45 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:56354 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730504AbfJYLrp (ORCPT ); Fri, 25 Oct 2019 07:47:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1572004041; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mz9JbxcWyvPWbx0nI2AEdeCSfmVBVosO5HLgE6B68I4=; b=HOt8Ncx2UqYCq9fg/D15nJ3f9LtDknGCgUfrYZXqHJzHa2dHHTgTnr1NZSd+eriPdk8Xyn eRAgc8JENIXZmRaDHuXSoCFyJrj5lu18lJcbvmvfdO22r8XZ3AMZ4JvmTT1Kkd3n2b8W9d t9+SYTvEpU6OB8qcnYR8e4Hnv0aC7+M= From: Paul Cercueil To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil Subject: [PATCH v2 4/6] usb: musb: jz4740: Drop dependency on NOP_USB_XCEIV Date: Fri, 25 Oct 2019 13:47:08 +0200 Message-Id: <20191025114710.13222-4-paul@crapouillou.net> In-Reply-To: <20191025114710.13222-1-paul@crapouillou.net> References: <20191025114710.13222-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The driver does not depend directly on the NOP transceiver. It can compile and work just fine without it. Signed-off-by: Paul Cercueil --- Notes: v2: New patch drivers/usb/musb/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 210e4844c92a..56ccba3c8444 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -111,7 +111,6 @@ config USB_MUSB_UX500 config USB_MUSB_JZ4740 tristate "JZ4740" - depends on NOP_USB_XCEIV depends on MIPS || COMPILE_TEST depends on USB_MUSB_GADGET depends on USB=n || USB_OTG_BLACKLIST_HUB From patchwork Fri Oct 25 11:47:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11212125 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29EF7139A for ; Fri, 25 Oct 2019 11:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F242C21D71 for ; Fri, 25 Oct 2019 11:47:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="KJfmhsCY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503817AbfJYLrw (ORCPT ); Fri, 25 Oct 2019 07:47:52 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:56498 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502199AbfJYLrw (ORCPT ); Fri, 25 Oct 2019 07:47:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1572004042; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kbyr+nLKwMc3HEXehadLYJ4V81bK8hSdN4NUOQzouq4=; b=KJfmhsCY18bg8zshwuW6SJQb9TwNLkY8so3+eozeyjA0nTZeDnF78kevfTVMVOzo4Z9tsI fXHqlJ+HYNwsFdX+nmNM4bxGuBc+Hs0tXyTcf7n7dYq7v7AEQkh7msssK16OCeAbN03CoQ TqyUmmDECfH3mwHjQ7PCaSn60WbiV7A= From: Paul Cercueil To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil Subject: [PATCH v2 5/6] usb: musb: jz4740: Silence error if code is -EPROBE_DEFER Date: Fri, 25 Oct 2019 13:47:09 +0200 Message-Id: <20191025114710.13222-5-paul@crapouillou.net> In-Reply-To: <20191025114710.13222-1-paul@crapouillou.net> References: <20191025114710.13222-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Avoid printing any error message if the error code is -EPROBE_DEFER. Signed-off-by: Paul Cercueil --- Notes: v2: New patch drivers/usb/musb/jz4740.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index bbecfdee6ea1..5e885fa26829 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -81,14 +81,17 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = { static int jz4740_musb_init(struct musb *musb) { struct device *dev = musb->controller->parent; + int err; if (dev->of_node) musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0); else musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); if (IS_ERR(musb->xceiv)) { - dev_err(dev, "No transceiver configured\n"); - return PTR_ERR(musb->xceiv); + err = PTR_ERR(musb->xceiv); + if (err != -EPROBE_DEFER) + dev_err(dev, "No transceiver configured: %d", err); + return err; } /* Silicon does not implement ConfigData register. From patchwork Fri Oct 25 11:47:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11212127 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34B35139A for ; Fri, 25 Oct 2019 11:48:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 086E621D82 for ; Fri, 25 Oct 2019 11:48:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="MXkSxCOG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503871AbfJYLsA (ORCPT ); Fri, 25 Oct 2019 07:48:00 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:56548 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502090AbfJYLsA (ORCPT ); Fri, 25 Oct 2019 07:48:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1572004043; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cXTdM1iYJIRwlbbc3jp68ODswWGd3EHXsEPzo5qnnfI=; b=MXkSxCOG6m8SqqXZlqOg86uSDWT2qMAkBsLEHvh4X21ZuRqcUdXAUBW1LwqST1Lu7+zZYt VUkbnCZLBTtJyI0x3CmHLTFcxn8TVYHW6riVZOOkesgXPzruIfP40wh7FM8khdJUnBPQSE d/qQd7C7MWL0fyl9d6hmJI+0wFsuUKI= From: Paul Cercueil To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil Subject: [PATCH v2 6/6] usb: musb: jz4740: Code cleanup Date: Fri, 25 Oct 2019 13:47:10 +0200 Message-Id: <20191025114710.13222-6-paul@crapouillou.net> In-Reply-To: <20191025114710.13222-1-paul@crapouillou.net> References: <20191025114710.13222-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Just some code maintenance; no functional change. Signed-off-by: Paul Cercueil --- Notes: v2: New patch drivers/usb/musb/jz4740.c | 71 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index 5e885fa26829..b755b6be7059 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -17,16 +17,15 @@ #include "musb_core.h" struct jz4740_glue { - struct device *dev; - struct platform_device *musb; + struct platform_device *musb; struct clk *clk; }; static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) { - unsigned long flags; - irqreturn_t retval = IRQ_NONE, retval_dma = IRQ_NONE; - struct musb *musb = __hci; + unsigned long flags; + irqreturn_t retval = IRQ_NONE, retval_dma = IRQ_NONE; + struct musb *musb = __hci; spin_lock_irqsave(&musb->lock, flags); @@ -43,7 +42,7 @@ static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) * never see them set */ musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME | - MUSB_INTR_RESET | MUSB_INTR_SOF; + MUSB_INTR_RESET | MUSB_INTR_SOF; if (musb->int_usb || musb->int_tx || musb->int_rx) retval = musb_interrupt(musb); @@ -57,25 +56,20 @@ static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) } static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = { -{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, -{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, -{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, }, + { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, }, }; static const struct musb_hdrc_config jz4740_musb_config = { /* Silicon does not implement USB OTG. */ - .multipoint = 0, + .multipoint = 0, /* Max EPs scanned, driver will decide which EP can be used. */ - .num_eps = 4, + .num_eps = 4, /* RAMbits needed to configure EPs from table */ - .ram_bits = 9, - .fifo_cfg = jz4740_musb_fifo_cfg, - .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg), -}; - -static struct musb_hdrc_platform_data jz4740_musb_platform_data = { - .mode = MUSB_PERIPHERAL, - .config = &jz4740_musb_config, + .ram_bits = 9, + .fifo_cfg = jz4740_musb_fifo_cfg, + .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg), }; static int jz4740_musb_init(struct musb *musb) @@ -94,7 +88,8 @@ static int jz4740_musb_init(struct musb *musb) return err; } - /* Silicon does not implement ConfigData register. + /* + * Silicon does not implement ConfigData register. * Set dyn_fifo to avoid reading EP config from hardware. */ musb->dyn_fifo = true; @@ -115,65 +110,69 @@ static const struct musb_platform_ops jz4740_musb_ops = { #endif }; +static const struct musb_hdrc_platform_data jz4740_musb_pdata = { + .mode = MUSB_PERIPHERAL, + .config = &jz4740_musb_config, + .platform_ops = &jz4740_musb_ops, +}; + static int jz4740_probe(struct platform_device *pdev) { - struct musb_hdrc_platform_data *pdata = &jz4740_musb_platform_data; + struct device *dev = &pdev->dev; + const struct musb_hdrc_platform_data *pdata = &jz4740_musb_pdata; struct platform_device *musb; struct jz4740_glue *glue; - struct clk *clk; + struct clk *clk; int ret; - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); if (!glue) return -ENOMEM; musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); if (!musb) { - dev_err(&pdev->dev, "failed to allocate musb device\n"); + dev_err(dev, "failed to allocate musb device"); return -ENOMEM; } - clk = devm_clk_get(&pdev->dev, "udc"); + clk = devm_clk_get(dev, "udc"); if (IS_ERR(clk)) { - dev_err(&pdev->dev, "failed to get clock\n"); + dev_err(dev, "failed to get clock"); ret = PTR_ERR(clk); goto err_platform_device_put; } ret = clk_prepare_enable(clk); if (ret) { - dev_err(&pdev->dev, "failed to enable clock\n"); + dev_err(dev, "failed to enable clock"); goto err_platform_device_put; } - musb->dev.parent = &pdev->dev; + musb->dev.parent = dev; musb->dev.dma_mask = &musb->dev.coherent_dma_mask; musb->dev.coherent_dma_mask = DMA_BIT_MASK(32); - glue->dev = &pdev->dev; glue->musb = musb; glue->clk = clk; - pdata->platform_ops = &jz4740_musb_ops; - platform_set_drvdata(pdev, glue); ret = platform_device_add_resources(musb, pdev->resource, pdev->num_resources); if (ret) { - dev_err(&pdev->dev, "failed to add resources\n"); + dev_err(dev, "failed to add resources"); goto err_clk_disable; } ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); if (ret) { - dev_err(&pdev->dev, "failed to add platform_data\n"); + dev_err(dev, "failed to add platform_data"); goto err_clk_disable; } ret = platform_device_add(musb); if (ret) { - dev_err(&pdev->dev, "failed to register musb device\n"); + dev_err(dev, "failed to register musb device"); goto err_clk_disable; } @@ -188,7 +187,7 @@ static int jz4740_probe(struct platform_device *pdev) static int jz4740_remove(struct platform_device *pdev) { - struct jz4740_glue *glue = platform_get_drvdata(pdev); + struct jz4740_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); clk_disable_unprepare(glue->clk); @@ -199,7 +198,7 @@ static int jz4740_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id jz4740_musb_of_match[] = { { .compatible = "ingenic,jz4740-musb" }, - {}, + { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, jz4740_musb_of_match); #endif