From patchwork Fri May 15 11:16:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cristian.birsan@microchip.com X-Patchwork-Id: 200484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 489F8C433E2 for ; Fri, 15 May 2020 11:17:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23A90204EF for ; Fri, 15 May 2020 11:17:04 +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="OTQ2D3I4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbgEOLQa (ORCPT ); Fri, 15 May 2020 07:16:30 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:32902 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726237AbgEOLQ2 (ORCPT ); Fri, 15 May 2020 07:16:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589541388; x=1621077388; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=/40a+Xw95DGQQJ2+L1yejq9q/M1oXwbhYnFs602PHAg=; b=OTQ2D3I4wkTiz+iRP1UiF+K4PbKvBo2JeCT4inztaV1LHPZXny/wFAFU CB+XlhaNo0F4kRRXRa/WZ9lwRtPAsEf24MoCqgL4qCog59alP2j/s0wVh XRleH52EGOzzc/OY5Nmpd52/py5NO23aOwh0l0k9SKN/GBH+wrHteLXW4 QiLfK1cHt30BxSHyBFdYybvYlT2H4NazqelVqndZ4O+eqP7yV6ySGa336 +XRlFXuFd2uVe0Ryo6AwDIcqG80tsatkJhy6kzvrWlbWr+vRqVkUrxMD3 ZsPAWctTxJOX4m9l0X1AUzJtkMZXVEkv/OeRpLnfpD0ARVqgJFhtIhFt4 Q==; IronPort-SDR: ZhHdvmBtstDBEEBJRD9Jbcrvs7hNd2Go3Q8JoBEOo3ZuAJJ5DGDu+8hCSDdkNMF7ZcFd15wgLs EVsr8Hj/staXk/mfe15ierBCoEiY7sTU9xIj+44a0+ZvNOViKajve5uLPwR6fJQrBOjniQ703N RMOLNPnfe/EsGNMyutsOfUmAFU30A/gb5/KX3YiT2lRLURx+8fmqxmT/PyPIaIAtJAentyHn0t Oyn0ryQi+3F9/ZtcRWNRLWnxHJFxzHb2R8QvlpMdgCTY+5e+8WqZDQlEFIEE6v6B+Lqm4sUM7c rE8= X-IronPort-AV: E=Sophos;i="5.73,395,1583218800"; d="scan'208";a="75380490" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 May 2020 04:16:26 -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.1713.5; Fri, 15 May 2020 04:16:26 -0700 Received: from cristi-P53.lan (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Fri, 15 May 2020 04:16:23 -0700 From: To: , , , , , , , , , , CC: Claudiu Beznea Subject: [PATCH v2 1/7] usb: gadget: udc: atmel: use of_find_matching_node_and_match Date: Fri, 15 May 2020 14:16:25 +0300 Message-ID: <20200515111631.31210-2-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200515111631.31210-1-cristian.birsan@microchip.com> References: <20200515111631.31210-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 22200341c8ec..2b154085dc6a 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -2052,6 +2052,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) { @@ -2067,13 +2074,17 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, return ERR_PTR(-EINVAL); udc->errata = match->data; - 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 Fri May 15 11:16:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cristian.birsan@microchip.com X-Patchwork-Id: 200485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1A52C433E2 for ; Fri, 15 May 2020 11:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 794F2204EF for ; Fri, 15 May 2020 11:17:01 +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="ZfqEIxeY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726288AbgEOLQh (ORCPT ); Fri, 15 May 2020 07:16:37 -0400 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:19631 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgEOLQf (ORCPT ); Fri, 15 May 2020 07:16:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589541394; x=1621077394; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=48f8UXh3qWiOzkNfswTmXKjjifYhI2PibhsXx6ECPRU=; b=ZfqEIxeYj86coDiyTP+CJXyFgF2R5oBcC/Ecuwih5Pa9yIAsqCVFEM9f KQj/g+Apj+j0pBgwIzvj8srWKOL/UUIF0XhYGQDz45R1boTt0Dc566dSm tzO1dD65Dk+D5GEKOgRWcFnRhQ8CzLKBkqxWnJJKKxt+MGGIb7s/Ijp0t ikLHM26whTDry2whUDzd17D/0n+r8rr2Jh/NfPBEOYTC/8nANe4YCHkl6 DBVhXnOQITdJVr9nsShgm3dCNiUdpRJZyvOWrIuvttAZJ63TrICOAkhLD gRuzwEePwdvoTp4FyxjB/2WPFbmHvNp5Svjau2IEQ4EJq4bVWuMWEDqtw A==; IronPort-SDR: WtV8k9mwn9EwVgbTjvZiooWtrdOfPcQ1xYy4NVnm/GLtBuQ1JnJVWSM6LBHFYjqP2zqPS9gVJQ CYARsmsJFeTSiy16Ei/T7fGRnIMK/5uzTW+BFrE9m+Pbe60b1PsOit58o6HCvrYGLBwIn9Iasd 8t/+C9/ScTjPIk0DKRS419A5C7proO5THHFLppNpF/d63c/FlwZVctmOFXwzq69t81+y+MlWsc 8meFew2h6dOzgnlBm0JpcPkGujRIiBVj8x4uxJCnZmnT+VzJFZdOHVSmZHuW07wCRQ0agNWQxI /PM= X-IronPort-AV: E=Sophos;i="5.73,395,1583218800"; d="scan'208";a="73566887" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 May 2020 04:16:33 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 15 May 2020 04:16:33 -0700 Received: from cristi-P53.lan (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Fri, 15 May 2020 04:16:30 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v2 3/7] usb: gadget: udc: atmel: simplify endpoint allocation Date: Fri, 15 May 2020 14:16:27 +0300 Message-ID: <20200515111631.31210-4-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200515111631.31210-1-cristian.birsan@microchip.com> References: <20200515111631.31210-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 2b154085dc6a..beb7246935a8 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1097,7 +1097,6 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget, ep->ept_cfg |= USBA_BF(BK_NUMBER, ep->nr_banks); - ep->udc->configured_ep++; } return _ep; @@ -1790,7 +1789,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 @@ -1838,13 +1837,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); + } } } @@ -2011,10 +2011,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); udc->driver = NULL; @@ -2095,7 +2091,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, pp = NULL; while ((pp = of_get_next_child(np, pp))) udc->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 a0225e4543d4..8de79356d31d 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -324,7 +324,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 Fri May 15 11:16:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cristian.birsan@microchip.com X-Patchwork-Id: 200486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8BDCC433E1 for ; Fri, 15 May 2020 11:16:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4B0E206D4 for ; Fri, 15 May 2020 11:16:56 +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="qlabrFSB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726465AbgEOLQz (ORCPT ); Fri, 15 May 2020 07:16:55 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:13950 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbgEOLQn (ORCPT ); Fri, 15 May 2020 07:16:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589541403; x=1621077403; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=M8yQNnHZuVdT9r1/rS/M/SeMts6Jhu8mlf3UsJER9oM=; b=qlabrFSBbBXQCPb9TeEVcHWcvyyb1dzLmUHYSiXWw02rlqsHzKX/F5Vv XmqpIKIDDwWox9FAKmF9B34u+jczI2/VzHP0clzCsVHLg53rbA+r963OR GGe1BdLynwOT27MVdiZ0/twDA+VYJ6MsbTJEE62f/iMnxXFeakorTdr6/ 8f3kmruqeui7i0NlBbYXwoSLbfm2XG7sDcgOwHMVymxUvIYkaOmScHXk/ ujf/rZTTEPoj5W3hXZllVLwLH3Z1RC1yk77JtvHygQpYTqWlKVvpRwl+O i94zi4DnSZ4BO9j1lbhPHHYG3AGIEtrvA+s37dx6VXC+CB4AEHnQJLptj A==; IronPort-SDR: sxRN6AYyixy98jYK0pJgpAbKE0SS6Fq4rWaqrtp1X5uWuw7wugQBo9ITcaXDwvjShVQhh3PAjL aS7CX5Wlx/jlihLj3nnIcJlogL0NgUS6y2iN4bQGoVoHFwHZ5Z8Tx6pL13AUCg/EYCOobp9aMJ AJqeAp+34Qw4KFzokv6jYsDQjJGM6gowSfK85lzmyoS5p2QLP1Vfzhu9UziRbbx1EmVAhr/RB8 1F4Lzdtm/DWizK5dptepd2kRxw9pkmUNXWVJtipleE/abtsZmKZ/5pTcKYGozFAxkA28YPUp/f zPU= X-IronPort-AV: E=Sophos;i="5.73,395,1583218800"; d="scan'208";a="79770140" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 May 2020 04:16:42 -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.1713.5; Fri, 15 May 2020 04:16:42 -0700 Received: from cristi-P53.lan (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Fri, 15 May 2020 04:16:39 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v2 6/7] usb: gadget: udc: atmel: update endpoint allocation for sam9x60 Date: Fri, 15 May 2020 14:16:30 +0300 Message-ID: <20200515111631.31210-7-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200515111631.31210-1-cristian.birsan@microchip.com> References: <20200515111631.31210-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 capabilities (caps) structure was extended. Signed-off-by: Cristian Birsan --- drivers/usb/gadget/udc/atmel_usba_udc.c | 22 ++++++++++++++++++---- drivers/usb/gadget/udc/atmel_usba_udc.h | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 2b1a0b6df0fe..ecd0fa9823bb 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1066,12 +1066,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->caps->ep_prealloc) + ep->nr_banks = 2; break; case USB_ENDPOINT_XFER_BULK: ep->fifo_size = 512; - ep->nr_banks = 1; + if (ep->udc->caps->ep_prealloc) + ep->nr_banks = 1; break; case USB_ENDPOINT_XFER_INT: @@ -1081,7 +1083,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->caps->ep_prealloc) + ep->nr_banks = 1; break; } @@ -2034,16 +2037,27 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc) static const struct usba_udc_caps at91sam9rl_caps = { .toggle_bias = at91sam9rl_toggle_bias, + .ep_prealloc = true, }; static const struct usba_udc_caps at91sam9g45_caps = { .pulse_bias = at91sam9g45_pulse_bias, + .ep_prealloc = true, +}; + +static const struct usba_udc_caps sama5d3_caps = { + .ep_prealloc = true, +}; + +static const struct usba_udc_caps at91sam9x60_caps = { + .ep_prealloc = false, }; static const struct of_device_id atmel_udc_dt_ids[] = { { .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_caps }, { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps }, - { .compatible = "atmel,sama5d3-udc" }, + { .compatible = "atmel,sama5d3-udc", .data = &sama5d3_caps }, + { .compatible = "microchip,sam9x60-udc", .data = &at91sam9x60_caps }, { /* sentinel */ } }; diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index 1a0f77bf8d4f..f9239e200e7a 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -305,6 +305,7 @@ struct usba_request { struct usba_udc_caps { void (*toggle_bias)(struct usba_udc *udc, int is_on); void (*pulse_bias)(struct usba_udc *udc); + bool ep_prealloc; }; struct usba_udc { From patchwork Fri May 15 11:16:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cristian.birsan@microchip.com X-Patchwork-Id: 200487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C49AFC433E0 for ; Fri, 15 May 2020 11:16:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A39C7204EF for ; Fri, 15 May 2020 11:16:53 +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="vIs0Yc4y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbgEOLQt (ORCPT ); Fri, 15 May 2020 07:16:49 -0400 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:19651 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbgEOLQs (ORCPT ); Fri, 15 May 2020 07:16:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589541406; x=1621077406; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=bZ2JnU0EXObNl5L5pPijjp9Xg73ORZBTgLZoGKU0TPk=; b=vIs0Yc4y3Tmd4D7Xh8iOXvq8/Evh3/WLQmcIsJOBCrO9cRCp8APw4UuC gmGGCBTmU98C1AVl3kpfjvk0TCI4mEvqsX2hzDvIJpgFLOTA8wiu/jKla uhDr4/V0jcLFSC15IYCu7KoDAES7sS3Qgd8bVN+uX9nEzkNk8JqpxTjLI qWFY6TmKn4+MhMCTyhFmUTd9/JrmsvvKoy3hM6NUQU4SHMShZJIwxcl6A JxQDuudlsjkUDI8gjxp5QJFx9+P13dFu+Lw5KSgs0vfHLzlGbxqPqO6hS esXKSyAAnyAGmvT87dBhAssR42jQHk+64n+ig4phqRUH565vXTpoVCiuV Q==; IronPort-SDR: XltXjzs+GU6yt//0omU6PmdLk2jQP5ZYtU64eC6H8VCmkAjLS49NYR8MzOiI46Jnogrfof4qVt ehDiHryI2RxBu5y7pXRfpiQPWJBnFDpYRG92vcKXEM5JWrOcnvnC6Z4oDH+2GVYHUXcrSsiJs7 6ECz0+hv5J7AG9MVaAUeKLhbYxDbJp7uAhFfwWiWt97uVdFLfVxnTVQmSrNqj/F76fDcOfVVI4 mPlaJXJY/asv87Ot5dBe+1VwcJPoQn1+vYOmGxAyMTh98NkWYB14wTJ+AmSy78BM1BNP8Y6fBm ERY= X-IronPort-AV: E=Sophos;i="5.73,395,1583218800"; d="scan'208";a="73566907" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 May 2020 04:16:46 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 15 May 2020 04:16:45 -0700 Received: from cristi-P53.lan (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Fri, 15 May 2020 04:16:42 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v2 7/7] ARM: dts: at91: sam9x60ek: enable usb device Date: Fri, 15 May 2020 14:16:31 +0300 Message-ID: <20200515111631.31210-8-cristian.birsan@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200515111631.31210-1-cristian.birsan@microchip.com> References: <20200515111631.31210-1-cristian.birsan@microchip.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 | 74 ++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts index b484745bf2d4..325d0fc8674f 100644 --- a/arch/arm/boot/dts/at91-sam9x60ek.dts +++ b/arch/arm/boot/dts/at91-sam9x60ek.dts @@ -547,6 +547,12 @@ atmel,pins = ; }; }; + + usb0 { + pinctrl_usba_vbus: usba_vbus { + atmel,pins = ; + }; + }; }; /* pinctrl */ &pmc { @@ -634,6 +640,13 @@ }; }; +&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..5cd2b9054762 100644 --- a/arch/arm/boot/dts/sam9x60.dtsi +++ b/arch/arm/boot/dts/sam9x60.dtsi @@ -69,6 +69,80 @@ #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"; + + ep@0 { + reg = <0>; + atmel,fifo-size = <64>; + atmel,nb-banks = <1>; + }; + + ep@1 { + reg = <1>; + atmel,fifo-size = <1024>; + atmel,nb-banks = <2>; + atmel,can-dma; + }; + + ep@2 { + reg = <2>; + atmel,fifo-size = <1024>; + atmel,nb-banks = <2>; + atmel,can-dma; + }; + + ep@3 { + reg = <3>; + atmel,fifo-size = <1024>; + atmel,nb-banks = <3>; + atmel,can-dma; + atmel,can-isoc; + }; + + ep@4 { + reg = <4>; + atmel,fifo-size = <1024>; + atmel,nb-banks = <3>; + atmel,can-dma; + atmel,can-isoc; + }; + + ep@5 { + reg = <5>; + atmel,fifo-size = <1024>; + atmel,nb-banks = <3>; + atmel,can-dma; + atmel,can-isoc; + }; + + ep@6 { + reg = <6>; + atmel,fifo-size = <1024>; + atmel,nb-banks = <3>; + atmel,can-dma; + atmel,can-isoc; + }; + + ep@7 { + reg = <7>; + atmel,fifo-size = <1024>; + atmel,nb-banks = <3>; + atmel,can-dma; + atmel,can-isoc; + }; + }; + usb1: ohci@600000 { compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x00600000 0x100000>;