From patchwork Wed Jul 22 13:44:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11678499 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 1FF0A912 for ; Wed, 22 Jul 2020 13:44:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03CE420787 for ; Wed, 22 Jul 2020 13:44:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="bL+X4ZI7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732489AbgGVNo3 (ORCPT ); Wed, 22 Jul 2020 09:44:29 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:34283 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732349AbgGVNo3 (ORCPT ); Wed, 22 Jul 2020 09:44:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595425468; x=1626961468; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LJ5a5zW2HlzZmrctuphKUjLbHmULw+4CLiQ9IBxCDFc=; b=bL+X4ZI7uaOTVL4lGxIKlw3q8Qyul90y+t4xj0TnafOoLsoIqHPAVd3V B+5aKOHFhaRDUmkDC89GmXXHOsAyaaKW+241pxSPuKu/CdffwCesMo4Ns FkHAhhJcL6jeVGvoxJvEnGTrjxsMFu20eYn/6sf0yEgb4MpeUBKlxnNXa YKHNNHooL4E53u3VBvgI9qNFBlaoumVu316VGQ0uURs+/M8LnANr3OMgx GNeOWfz3BQnxr1kbgfLeNT87prTJAKXziWuMPhLRtJk6ihNvaPS8PnHA2 L/wSEe6WWR+KXe4UfsB1NZCUSWotXDRwVAdA+7DaXR9ZGsFHgs1TKmoi1 A==; IronPort-SDR: c+T80368qAGQokoVoIRBT4mGga38vMwiY9veQa/e7thJA3szdFsuHMhRG579esd66j+IFIoof5 nHQQ5/cUCTI2RPXNWLwabFzDN44pVPUgzLhTsq7dKf4el4MP5lcwqO6Mun23LB4Vgp5n3UmmLj zzcLlmtZINjEpaf6cBUBi2K1UOAIT99hSmlRknRlEoEFVMKjpii9ovI1ATh3TIdx3gFFJAK6KZ Ahf0YelzNbTHyq+nfry3oXVfnxJcJGz2LdKBmlgc/qhrHDVrYsUAW+11C3HFFX0mTxI6IeBm6P o2E= X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="84955380" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Jul 2020 06:44:28 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 22 Jul 2020 06:44:28 -0700 Received: from cristi-P53.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 22 Jul 2020 06:43:46 -0700 From: To: , , , , , , , , , , CC: Claudiu Beznea Subject: [PATCH v3 1/6] usb: gadget: udc: atmel: use of_find_matching_node_and_match Date: Wed, 22 Jul 2020 16:44:16 +0300 Message-ID: <20200722134421.190741-2-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200722134421.190741-1-cristian.birsan@microchip.com> References: <20200722134421.190741-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Claudiu Beznea Instead of trying to match every possible compatible use of_find_matching_node_and_match() and pass the compatible array. Signed-off-by: Claudiu Beznea --- drivers/usb/gadget/udc/atmel_usba_udc.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index c5128c229c52..ee2b550aa400 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -2112,6 +2112,13 @@ static const struct of_device_id atmel_udc_dt_ids[] = { MODULE_DEVICE_TABLE(of, atmel_udc_dt_ids); +static const struct of_device_id atmel_pmc_dt_ids[] = { + { .compatible = "atmel,at91sam9g45-pmc" }, + { .compatible = "atmel,at91sam9rl-pmc" }, + { .compatible = "atmel,at91sam9x5-pmc" }, + { /* sentinel */ } +}; + static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, struct usba_udc *udc) { @@ -2128,13 +2135,17 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, udc_config = match->data; udc->errata = udc_config->errata; - udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc"); - if (IS_ERR(udc->pmc)) - udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9rl-pmc"); - if (IS_ERR(udc->pmc)) - udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9x5-pmc"); - if (udc->errata && IS_ERR(udc->pmc)) - return ERR_CAST(udc->pmc); + if (udc->errata) { + pp = of_find_matching_node_and_match(NULL, atmel_pmc_dt_ids, + NULL); + if (!pp) + return ERR_PTR(-ENODEV); + + udc->pmc = syscon_node_to_regmap(pp); + of_node_put(pp); + if (IS_ERR(udc->pmc)) + return ERR_CAST(udc->pmc); + } udc->num_ep = 0; From patchwork Wed Jul 22 13:44:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11678509 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 37DC1912 for ; Wed, 22 Jul 2020 13:45:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EDD420787 for ; Wed, 22 Jul 2020 13:45:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="2mNk1t3x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732575AbgGVNpD (ORCPT ); Wed, 22 Jul 2020 09:45:03 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:56885 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732510AbgGVNok (ORCPT ); Wed, 22 Jul 2020 09:44:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595425480; x=1626961480; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JFzmp3IpT2/vSAdFB2tkC7kXSDjHPZkrYg58Jnu3Ns4=; b=2mNk1t3xt2H4Av1TvZ44c3zedYzUEYvkphKPu6JwjL4wydpystUY/3aW MS+LbxErt0b8aqJoGpIjvByiJDZNsK8Pu5bGBagZg54qxAc6k+vApRB4B wl8jXIzms54IllJVmcB3qZubLAEuH83d7VbTABYVKT9u3ySYXgZ1yQJEr ohKpBbzGvvrAUOZJAN9ke8k59t3KRdO7vF7B7l5l910yTMuVLn03D3DtI /P7Hu5QP/vlxuvpUxDr1Gf406wsaGOAokX1NarvXU/T6VmP97I+OYBJWJ SrmBLal6KQjrk5g9WMRcmswPEICHFXvH4ziu8mC1UucNufEsN87HaBYN0 A==; IronPort-SDR: GXI+AelBLfDF4k+vg4jPexQSY4dmsVzVsrIyDtwSkCHaEO9CNQK90IdR5elR1COg+J1keBMh3W skM/d1jPPOLqTTn2lUYjFABaaB+eRdeWPZ5sMB+OjsQWB6LkYCGDFzOok/V8Vs982cNp45Sp7Y 9EfKFLFkx+m40AsUVZ6JyWT1KIlbdLJYVyKBs3XKoaGigFSUVLYSyV845BBbLQv6ath3ow8PD0 yOl87UkwswFC4KTXLDkFkx2bjb/Uyt04gnEK903G+/Ba0ULMvjHpSpCe7tg5FKAr3PUSOkydMG lsk= X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="82819489" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Jul 2020 06:44:32 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 22 Jul 2020 06:44:31 -0700 Received: from cristi-P53.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 22 Jul 2020 06:43:50 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan , Rob Herring Subject: [PATCH v3 2/6] dt-bindings: usb: atmel: Update DT bindings documentation for sam9x60 Date: Wed, 22 Jul 2020 16:44:17 +0300 Message-ID: <20200722134421.190741-3-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200722134421.190741-1-cristian.birsan@microchip.com> References: <20200722134421.190741-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Cristian Birsan Add sam9x60 binding. Signed-off-by: Cristian Birsan Acked-by: Rob Herring --- Documentation/devicetree/bindings/usb/atmel-usb.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt index 423b99a8fd97..a4002624ba14 100644 --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt @@ -82,6 +82,7 @@ Required properties: "atmel,at91sam9rl-udc" "atmel,at91sam9g45-udc" "atmel,sama5d3-udc" + "microchip,sam9x60-udc" - reg: Address and length of the register set for the device - interrupts: Should contain usba interrupt - clocks: Should reference the peripheral and host clocks From patchwork Wed Jul 22 13:44:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11678503 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 A4BA7138A for ; Wed, 22 Jul 2020 13:44:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8ADD82071A for ; Wed, 22 Jul 2020 13:44:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="WS9qjfzK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732526AbgGVNoo (ORCPT ); Wed, 22 Jul 2020 09:44:44 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:56875 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726425AbgGVNol (ORCPT ); Wed, 22 Jul 2020 09:44:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595425480; x=1626961480; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0CglqN8t+sTEsXBUJ/2FtzkYtZYDjKY0BLV6728dXSU=; b=WS9qjfzKFLDzSMyK+9045cMTT70ypwpea088mLWwl3hCYuSCM4r81twM Ozo2HlduM4YjWGYSYZnlSwq+kYl6FgwTYPWtF6tEsWVfQ3rb+lAUYrOoo GhP4rKDH+Oz++hq4pN0CBNj0F3KthZEp52pMLqoO+gdXSGCSNZ6ckMWrL MfFLn3M5vnKiiWOI9D8FL1QqtrGAT0LaZ97uN906X/ujtSh/+Hw0u1i8F vPMMEpspwejzwFEOvm7otAEzfV/ujRLx0Zeth2kdH+hQkPCt/s/BxyBrh +IPJSD8Z0a6lg7TT65g6UiJ90GiBebNLn0CMyvei0NZyDjvajzWRC+bwm g==; IronPort-SDR: AXgHdc5hrmjiNfDxEtVSDkRkfo421fQzhy/PbGutmo9wv+W/wmSvJEnSYAQIVtQu0FGhmSvqj+ 8qA28PUuJHWboRVEgUE5HTr+4ZFxqDcBESUul/Gn7yIGteb3eM/s8GqG9gRrY+LM9YSSXSoABK A0yvMsUsnM3pGNxZYpCV3eYmmb4lGSrB0Ty/GcyJ+JKLSETnShRnvjz9kzbxcggFxRX2UW1D// l8uLsrVOnNgjCdt7vj19dMwhWSdQRhiZ8keWKytjlSbrsh4CJv2WkvPXaQ9PkwtXPV2zASpjO/ hfk= X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="82819495" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Jul 2020 06:44:35 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 22 Jul 2020 06:44:34 -0700 Received: from cristi-P53.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 22 Jul 2020 06:43:53 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v3 3/6] usb: gadget: udc: atmel: simplify endpoint allocation Date: Wed, 22 Jul 2020 16:44:18 +0300 Message-ID: <20200722134421.190741-4-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200722134421.190741-1-cristian.birsan@microchip.com> References: <20200722134421.190741-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Cristian Birsan Simplify the endpoint allocation and cleanup the code. Signed-off-by: Cristian Birsan --- drivers/usb/gadget/udc/atmel_usba_udc.c | 21 ++++++++------------- drivers/usb/gadget/udc/atmel_usba_udc.h | 1 - 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index ee2b550aa400..f767708598a4 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1091,8 +1091,6 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget, USBA_BF(EPT_SIZE, fls(ep->fifo_size - 1) - 3); ep->ept_cfg |= USBA_BF(BK_NUMBER, ep->nr_banks); - - ep->udc->configured_ep++; } return _ep; @@ -1786,7 +1784,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) if (status & USBA_END_OF_RESET) { struct usba_ep *ep0, *ep; - int i, n; + int i; usba_writel(udc, INT_CLR, USBA_END_OF_RESET|USBA_END_OF_RESUME @@ -1834,13 +1832,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) "ODD: EP0 configuration is invalid!\n"); /* Preallocate other endpoints */ - n = fifo_mode ? udc->num_ep : udc->configured_ep; - for (i = 1; i < n; i++) { + for (i = 1; i < udc->num_ep; i++) { ep = &udc->usba_ep[i]; - usba_ep_writel(ep, CFG, ep->ept_cfg); - if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED)) - dev_err(&udc->pdev->dev, - "ODD: EP%d configuration is invalid!\n", i); + if (ep->ep.claimed) { + usba_ep_writel(ep, CFG, ep->ept_cfg); + if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED)) + dev_err(&udc->pdev->dev, + "ODD: EP%d configuration is invalid!\n", i); + } } } @@ -2025,9 +2024,6 @@ static int atmel_usba_stop(struct usb_gadget *gadget) if (udc->vbus_pin) disable_irq(gpiod_to_irq(udc->vbus_pin)); - if (fifo_mode == 0) - udc->configured_ep = 1; - udc->suspended = false; usba_stop(udc); @@ -2155,7 +2151,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, if (fifo_mode == 0) { pp = NULL; udc->num_ep = udc_config->num_ep; - udc->configured_ep = 1; } else { udc->num_ep = usba_config_fifo_table(udc); } diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index 48e332439ed5..a9bf655eb513 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -336,7 +336,6 @@ struct usba_udc { int irq; struct gpio_desc *vbus_pin; int num_ep; - int configured_ep; struct usba_fifo_cfg *fifo_cfg; struct clk *pclk; struct clk *hclk; From patchwork Wed Jul 22 13:44:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11678511 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 9B572912 for ; Wed, 22 Jul 2020 13:45:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 831462084D for ; Wed, 22 Jul 2020 13:45:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="MZG7qzpW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732502AbgGVNoj (ORCPT ); Wed, 22 Jul 2020 09:44:39 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:61799 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726425AbgGVNoj (ORCPT ); Wed, 22 Jul 2020 09:44:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595425479; x=1626961479; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fZFijBDp+zC7Kvsv+QSpK47JNGdPCmrZsJ0YhaqC5bc=; b=MZG7qzpWnpLtI8jZbHBdUeLT6QMmpw60FeSTljCeKL8xX03ec+jqTz9/ UNStYDAN+FpiSvHQKKWJ9nqn3Oo2WahvfnCTzfLXsdKCr8cPDU133V1zp yrmt3vb4KAoTk7ohiv3x15I1+Lr4Vrm/NiywYOvg1/048EHki5eKQKYvx G13triMWRonRL1cV+ZzQ3+3zYLxv6DEq7by8caRVTnnB1aKjw/SD+EMfA xOHzVTkaKyTZ8rcVrHFxcU2Dt29eydlcJbdtskNt/DSJBBNDRSqWWgBJj u8Ip4lcOeMlp7iQgEuAN2pjQYxkycPHWueTADg8WXWDpRHJdrR4XkoEC0 A==; IronPort-SDR: +uya+0eoE4FTv1+6lxDOJXYwlB8UV05G5dGZkZes8Q4SIHHgXYJxW/eg19WdtKD+MuITlDfcL+ GFhtlpz7vhW5cDDyhaj2rXOX2MrbTnbrXCC24pe66ewJBP0hmd1I3HnBBtSiHp9l0AS4oeIMTY W3HsZEkDBibIGveNQRyeBfILi3g4ekw+0Iwe9T8UPDqsm9Ax30IvwnmxDSydiaE29Jb3Y5BQ7b K/3DoYfJSmbfsubW9e0tnqaOWdYT66aD03Yu18NI3+tnnrVi+WSZFkyF0XExU9JE1z0FLJ7gf7 Xe0= X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="84198378" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Jul 2020 06:44:39 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 22 Jul 2020 06:44:37 -0700 Received: from cristi-P53.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 22 Jul 2020 06:43:56 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v3 4/6] usb: gadget: udc: atmel: use 1 bank endpoints for control transfers Date: Wed, 22 Jul 2020 16:44:19 +0300 Message-ID: <20200722134421.190741-5-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200722134421.190741-1-cristian.birsan@microchip.com> References: <20200722134421.190741-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Cristian Birsan Use 1 bank endpoints for control transfers Signed-off-by: Cristian Birsan --- drivers/usb/gadget/udc/atmel_usba_udc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index f767708598a4..843ba525d277 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1056,6 +1056,7 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget, switch (usb_endpoint_type(desc)) { case USB_ENDPOINT_XFER_CONTROL: + ep->nr_banks = 1; break; case USB_ENDPOINT_XFER_ISOC: From patchwork Wed Jul 22 13:44:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11678507 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 DA03C138A for ; Wed, 22 Jul 2020 13:45:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1E862084D for ; Wed, 22 Jul 2020 13:45:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="fiHFW9K/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732544AbgGVNo4 (ORCPT ); Wed, 22 Jul 2020 09:44:56 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:56891 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732519AbgGVNon (ORCPT ); Wed, 22 Jul 2020 09:44:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595425482; x=1626961482; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AZqakvsW2eY/rh4CY+P6S9cbwQSN2N9lnmvXsIkmBcE=; b=fiHFW9K/WfuVumcBWKHYHiGIflMHxgrn5B1rgVBPP4JaqSnFKMzi79A5 NWbhGwzviJmq5/B8PKcaua42AVUFIY9ZUifw7gQUGWHUC8Y+lE7Rm23j4 I/Ov1zmsLppxUoN0ysKP5u01KTVYaOqy4PVz1pNAr9Vx6kT4H1aPNO7lJ bkUStDOcFjvKysxo6hCwzKU6XOL4lcA36nlJh9euFRAe0oxXrI+qXX6t8 MDS8YejIsa9Nybae7bmNi5LMjzeMy+rCkDmaaF+46L59J6YkTEWC5DPQ+ /dcnCn3x+6LNfcuGfcvoSkVs9qDk5LBWAeJwhIM0f45+VYg1nv9Ytmhj1 g==; IronPort-SDR: d41XxWmnb0xhsPys09rpdMOC4O+Jcu8EfT3soG7xYWIeBA6Ib9gYeYcR0KJrx+hwKtylfxRBRf KEZMGuxs2iyud6GwWflKSW2KpfUEGOpwB5+twSUPCeB5rdSJBHNX+hFbD0UvPJsL17tCGEAC5i ulg5Tdhh74wplsnYRiAMqHPa04oOTvuEinxRHGvbDwMBJa4Skl+KThi3vh0ayxmeRnog0B9In0 7lKtBD3zKO4u4JTRlhDG8MVIdVnv2pwDsSxK1Fia3jsETTyWLEBVVSyXYOhgFB9LFBwxSlgrzY L9Q= X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="82819500" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Jul 2020 06:44:41 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 22 Jul 2020 06:44:41 -0700 Received: from cristi-P53.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 22 Jul 2020 06:43:59 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v3 5/6] usb: gadget: udc: atmel: update endpoint allocation for sam9x60 Date: Wed, 22 Jul 2020 16:44:20 +0300 Message-ID: <20200722134421.190741-6-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200722134421.190741-1-cristian.birsan@microchip.com> References: <20200722134421.190741-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Cristian Birsan The DPRAM memory from the USB High Speed Device Port (UDPHS) hardware block was increased. This patch updates the endpoint allocation for sam9x60 to take advantage of this larger memory. At the same time the constraint to allocate the endpoints in order was lifted. To handle old and new hardware in the same driver the ep_prealloc was added. Signed-off-by: Cristian Birsan --- drivers/usb/gadget/udc/atmel_usba_udc.c | 20 +++++++++++++++++--- drivers/usb/gadget/udc/atmel_usba_udc.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 843ba525d277..8015b99f6b5c 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1061,12 +1061,14 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget, case USB_ENDPOINT_XFER_ISOC: ep->fifo_size = 1024; - ep->nr_banks = 2; + if (ep->udc->ep_prealloc) + ep->nr_banks = 2; break; case USB_ENDPOINT_XFER_BULK: ep->fifo_size = 512; - ep->nr_banks = 1; + if (ep->udc->ep_prealloc) + ep->nr_banks = 1; break; case USB_ENDPOINT_XFER_INT: @@ -1076,7 +1078,8 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget, else ep->fifo_size = roundup_pow_of_two(le16_to_cpu(desc->wMaxPacketSize)); - ep->nr_banks = 1; + if (ep->udc->ep_prealloc) + ep->nr_banks = 1; break; } @@ -2087,23 +2090,33 @@ static const struct usba_udc_config udc_at91sam9rl_cfg = { .errata = &at91sam9rl_errata, .config = ep_config_sam9, .num_ep = ARRAY_SIZE(ep_config_sam9), + .ep_prealloc = true, }; static const struct usba_udc_config udc_at91sam9g45_cfg = { .errata = &at91sam9g45_errata, .config = ep_config_sam9, .num_ep = ARRAY_SIZE(ep_config_sam9), + .ep_prealloc = true, }; static const struct usba_udc_config udc_sama5d3_cfg = { .config = ep_config_sama5, .num_ep = ARRAY_SIZE(ep_config_sama5), + .ep_prealloc = true, +}; + +static const struct usba_udc_config udc_sam9x60_cfg = { + .num_ep = ARRAY_SIZE(ep_config_sam9), + .config = ep_config_sam9, + .ep_prealloc = false, }; static const struct of_device_id atmel_udc_dt_ids[] = { { .compatible = "atmel,at91sam9rl-udc", .data = &udc_at91sam9rl_cfg }, { .compatible = "atmel,at91sam9g45-udc", .data = &udc_at91sam9g45_cfg }, { .compatible = "atmel,sama5d3-udc", .data = &udc_sama5d3_cfg }, + { .compatible = "microchip,sam9x60-udc", .data = &udc_sam9x60_cfg }, { /* sentinel */ } }; @@ -2131,6 +2144,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, return ERR_PTR(-EINVAL); udc_config = match->data; + udc->ep_prealloc = udc_config->ep_prealloc; udc->errata = udc_config->errata; if (udc->errata) { pp = of_find_matching_node_and_match(NULL, atmel_pmc_dt_ids, diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index a9bf655eb513..620472f218bc 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -317,6 +317,7 @@ struct usba_udc_config { const struct usba_udc_errata *errata; const struct usba_ep_config *config; const int num_ep; + const bool ep_prealloc; }; struct usba_udc { @@ -343,6 +344,7 @@ struct usba_udc { bool bias_pulse_needed; bool clocked; bool suspended; + bool ep_prealloc; u16 devstatus; From patchwork Wed Jul 22 13:44:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11678505 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 9FE61618 for ; Wed, 22 Jul 2020 13:44:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 870EC2080D for ; Wed, 22 Jul 2020 13:44:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="nlLzWBUD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732538AbgGVNor (ORCPT ); Wed, 22 Jul 2020 09:44:47 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:56907 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732528AbgGVNop (ORCPT ); Wed, 22 Jul 2020 09:44:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595425485; x=1626961485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AQ4wWOdIKVge/cPSYMb3D9ty6S2PPK3wNKVv4CCqRH8=; b=nlLzWBUDRwgIDh8+POxeg543AT3HANGaEFx4nLx7x+TJIkFukrdgBvka dMK/Ic91FNsK556fW7yeot43WYbVP8FZSKz+yBiOzh6Q9ES7vSxvxn8pF dqba0m2USMAwDO1es+WNEenvvstdQP5cxyfXVu0Ksy7QMc0CWf5nrJtDQ GgCyCGbbjQgM+senwEXoTwpnH53YYsGDmgueSKzV+oFGXQmxFVjpHobPJ Qh/HJxiF1VHSATMBWe8ayOqTai8Tc6P96YujjXrAYyPaUjSlJKPdtk5XQ jBLa3kG3zOLPqX0jXZtodiZvijOHOcs/4WU+v2HCIGxPqfpl6QbaHG2Yb g==; IronPort-SDR: i+HSXrkki1DPvbMVjDVRBXRvxME0nWWWV776wU6w/EzuTmJ2XRr9NT6vx54gRpARLB6RHVJZ1L UtH8q8aqNmsUR8tlu3aHyJ15q8zW49rvXA4rxYQ/XxY5aaJDiRn703LPXhasKYM84kcij/fZLN eK0kk4LWYtTqHLa7r5N4NFL6AfGcbmCkCdU6DzqFjDiYkzRI76LlUyODkaETEWN3ICRQ9IIlXW z/SmAMbYSUJzCl3xGL/0ykT68CBngqoPRDg9qo+c+3IP+MkDB/+Rug6tROcMBOy+jClfilgyz3 BzU= X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="82819506" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Jul 2020 06:44:44 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 22 Jul 2020 06:44:44 -0700 Received: from cristi-P53.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 22 Jul 2020 06:44:02 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v3 6/6] ARM: dts: at91: sam9x60ek: enable usb device Date: Wed, 22 Jul 2020 16:44:21 +0300 Message-ID: <20200722134421.190741-7-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200722134421.190741-1-cristian.birsan@microchip.com> References: <20200722134421.190741-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Cristian Birsan Enable usb device for sam9x60ek board. Signed-off-by: Cristian Birsan --- arch/arm/boot/dts/at91-sam9x60ek.dts | 13 +++++++++++++ arch/arm/boot/dts/sam9x60.dtsi | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts index a5f5718c711a..984cf596dfe9 100644 --- a/arch/arm/boot/dts/at91-sam9x60ek.dts +++ b/arch/arm/boot/dts/at91-sam9x60ek.dts @@ -559,6 +559,12 @@ pinctrl_key_gpio_default: pinctrl_key_gpio { atmel,pins = ; }; }; + + usb0 { + pinctrl_usba_vbus: usba_vbus { + atmel,pins = ; + }; + }; }; /* pinctrl */ &pmc { @@ -657,6 +663,13 @@ timer1: timer@1 { }; }; +&usb0 { + atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usba_vbus>; + status = "okay"; +}; + &usb1 { num-ports = <3>; atmel,vbus-gpio = <0 diff --git a/arch/arm/boot/dts/sam9x60.dtsi b/arch/arm/boot/dts/sam9x60.dtsi index 6763423d64b8..ef0ef8625f25 100644 --- a/arch/arm/boot/dts/sam9x60.dtsi +++ b/arch/arm/boot/dts/sam9x60.dtsi @@ -69,6 +69,20 @@ ahb { #size-cells = <1>; ranges; + usb0: gadget@500000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "microchip,sam9x60-udc"; + reg = <0x00500000 0x100000 + 0xf803c000 0x400>; + interrupts = <23 IRQ_TYPE_LEVEL_HIGH 2>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 23>, <&pmc PMC_TYPE_CORE PMC_UTMI>; + clock-names = "pclk", "hclk"; + assigned-clocks = <&pmc PMC_TYPE_CORE PMC_UTMI>; + assigned-clock-rates = <480000000>; + status = "disabled"; + }; + usb1: ohci@600000 { compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x00600000 0x100000>;