From patchwork Thu Jan 22 16:56:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylvain Rochet X-Patchwork-Id: 5686821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BC1D39F357 for ; Thu, 22 Jan 2015 17:00:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D27DD20259 for ; Thu, 22 Jan 2015 17:00:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3C16200DC for ; Thu, 22 Jan 2015 17:00:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YEL5U-0005EB-FO; Thu, 22 Jan 2015 16:58:32 +0000 Received: from mx-guillaumet.finsecur.com ([91.217.234.131] helo=guillaumet.finsecur.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YEL4H-0004WC-ON for linux-arm-kernel@lists.infradead.org; Thu, 22 Jan 2015 16:57:19 +0000 Received: from [172.16.8.13] (helo=spice.lan) by guillaumet.finsecur.com with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YEL3m-000C3u-Qq; Thu, 22 Jan 2015 17:56:47 +0100 Received: from gradator by spice.lan with local (Exim 4.84) (envelope-from ) id 1YEL3m-0008QG-K4; Thu, 22 Jan 2015 17:56:46 +0100 From: Sylvain Rochet To: Boris Brezillon , Alexandre Belloni , plagnioj@jcrosoft.com, nicolas.ferre@atmel.com, linux-arm-kernel@lists.infradead.org, voice.shen@atmel.com, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Wenyou Yang Date: Thu, 22 Jan 2015 17:56:44 +0100 Message-Id: <1421945805-31129-5-git-send-email-sylvain.rochet@finsecur.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421945805-31129-1-git-send-email-sylvain.rochet@finsecur.com> References: <1421945805-31129-1-git-send-email-sylvain.rochet@finsecur.com> X-SA-Exim-Connect-IP: 172.16.8.13 X-SA-Exim-Mail-From: sylvain.rochet@finsecur.com X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Subject: [PATCHv6 4/5] USB: gadget: atmel_usba_udc: Prepare for IRQ single edge support X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on guillaumet.finsecur.com) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150122_085718_035871_A61E6577 X-CRM114-Status: GOOD ( 14.26 ) X-Spam-Score: -0.7 (/) Cc: Sylvain Rochet X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Renamed struct usba_udc_errata to struct usba_udc_caps, we are adding a new property which is not about errata, this way the struct is not misnamed. New struct usba_udc_caps property: irq_single_edge_support, boolean, set to true if the board supports IRQ_TYPE_EDGE_FALLING and IRQ_TYPE_EDGE_RISING, otherwise set to false. Signed-off-by: Sylvain Rochet Acked-by: Boris Brezillon --- drivers/usb/gadget/udc/atmel_usba_udc.c | 25 +++++++++++++++---------- drivers/usb/gadget/udc/atmel_usba_udc.h | 5 +++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index d554106..361f740 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -338,8 +338,8 @@ static int vbus_is_present(struct usba_udc *udc) static void toggle_bias(struct usba_udc *udc, int is_on) { - if (udc->errata && udc->errata->toggle_bias) - udc->errata->toggle_bias(udc, is_on); + if (udc->caps && udc->caps->toggle_bias) + udc->caps->toggle_bias(udc, is_on); } static void generate_bias_pulse(struct usba_udc *udc) @@ -347,8 +347,8 @@ static void generate_bias_pulse(struct usba_udc *udc) if (!udc->bias_pulse_needed) return; - if (udc->errata && udc->errata->pulse_bias) - udc->errata->pulse_bias(udc); + if (udc->caps && udc->caps->pulse_bias) + udc->caps->pulse_bias(udc); udc->bias_pulse_needed = false; } @@ -1901,18 +1901,23 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc) at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN); } -static const struct usba_udc_errata at91sam9rl_errata = { +static const struct usba_udc_caps at91sam9rl_caps = { .toggle_bias = at91sam9rl_toggle_bias, }; -static const struct usba_udc_errata at91sam9g45_errata = { +static const struct usba_udc_caps at91sam9g45_caps = { .pulse_bias = at91sam9g45_pulse_bias, + .irq_single_edge_support = true, +}; + +static const struct usba_udc_caps sama5d3_caps = { + .irq_single_edge_support = true, }; static const struct of_device_id atmel_udc_dt_ids[] = { - { .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_errata }, - { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_errata }, - { .compatible = "atmel,sama5d3-udc" }, + { .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_caps }, + { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps }, + { .compatible = "atmel,sama5d3-udc", .data = &sama5d3_caps }, { /* sentinel */ } }; @@ -1934,7 +1939,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, if (!match) return ERR_PTR(-EINVAL); - udc->errata = match->data; + udc->caps = match->data; udc->num_ep = 0; diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index 085749a..4fe4c87 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -304,9 +304,10 @@ struct usba_request { unsigned int mapped:1; }; -struct usba_udc_errata { +struct usba_udc_caps { void (*toggle_bias)(struct usba_udc *udc, int is_on); void (*pulse_bias)(struct usba_udc *udc); + bool irq_single_edge_support; }; struct usba_udc { @@ -322,7 +323,7 @@ struct usba_udc { struct usb_gadget gadget; struct usb_gadget_driver *driver; struct platform_device *pdev; - const struct usba_udc_errata *errata; + const struct usba_udc_caps *caps; int irq; int vbus_pin; int vbus_pin_inverted;