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 X-Patchwork-Id: 11551247 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 88E03697 for ; Fri, 15 May 2020 11:17:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71504207D0 for ; Fri, 15 May 2020 11:17:03 +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 S1726241AbgEOLQa (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: 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 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:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11551231 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 9D1A0138A for ; Fri, 15 May 2020 11:16:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 887F2206D4 for ; Fri, 15 May 2020 11:16:38 +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="ogPv4y5x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726252AbgEOLQe (ORCPT ); Fri, 15 May 2020 07:16:34 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:52350 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbgEOLQb (ORCPT ); Fri, 15 May 2020 07:16:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589541391; x=1621077391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=NM+S8OMTmsMYRTLlSMp9bGaPdfxmccXI/+aoH5UKQmY=; b=ogPv4y5xKym60PKowlDyCrIh/OCPCwuIBeCeRnIkdIgQP6w01STdN/Uh AoNkIU0R/L6AmSzdphYDtSeN4Fob/yshGBuJUSWBoaz5rRddA2Qh+GTuV /GEsXSm6RhB9ByJTYQYqBvgX1dlpiEiHSbZ8BhzcK24oaewhHV9AbkjkK yp9/7tu3qDdEth8ZNpA7Ou6BeCuKkxdlyxQKdipM5ehxzblFBHsxl15CF DNGzPPK+i2e6D8zfDepK3z8GjyCkqx4cXGgC3JVO+49DJK/d/2Q+gCThq WRcPKYsszdHSoMia8MwkSRWjc7Fws76Tgj9nd9yRK2HxZMR2q13B85XRM A==; IronPort-SDR: CdLWEe7E4LxivjZ4UG+P6hnBSPXZ+sOsohJl8T/n6fIosdWxU9OrfZu8YOCEOIDgBeyHTS4yaa GSlYgI+X3J8Ql4lI1gfPOw8qCPW4nDov+GmuufP0ePD4152C1DQTZy1SneGxTPmx/Bdt+kF3J1 KGIu3NPVBdIPuUz7nlIjmAw+avMhzLj/HUKPAZH8mXrmYdDTyeVSZBPvoi4KEG+ey5/GMvNODy oW+qxXq+LPWwOQ8ffCELkN6qJfWA9K5SgicR5wQh86REfSxas27JQ2wvs1uGW12s18xK3y38eq 5/I= X-IronPort-AV: E=Sophos;i="5.73,395,1583218800"; d="scan'208";a="76028022" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 May 2020 04:16:30 -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:29 -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:27 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v2 2/7] dt-bindings: usb: atmel: Update DT bindings documentation for sam9x60 Date: Fri, 15 May 2020 14:16:26 +0300 Message-ID: <20200515111631.31210-3-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: 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 44e80153b148..bae2b928a014 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 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 X-Patchwork-Id: 11551235 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 4351A697 for ; Fri, 15 May 2020 11:16:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DA572074D for ; Fri, 15 May 2020 11:16:42 +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 S1726292AbgEOLQh (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: 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 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:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11551243 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 AE8CE14C0 for ; Fri, 15 May 2020 11:16:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8DAAA206D4 for ; Fri, 15 May 2020 11:16:55 +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="0j0v6Tv1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726304AbgEOLQl (ORCPT ); Fri, 15 May 2020 07:16:41 -0400 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:49123 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbgEOLQi (ORCPT ); Fri, 15 May 2020 07:16:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589541397; x=1621077397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=fQTNhgyNE/Ii16r6bBKjezIrqfpVvQZb1l6/3n2gUnA=; b=0j0v6Tv1MeaHkwedAqHhlh7RXl789Rp/WdgKc4g/W6+ucrTZX5BPRGTj KEcAsdFbAAoJ1x9q2eRmf08LezKpE+m5O4e5h4p9MJAmB0e6SvremvL2J IBUJYuzBE1/FySdwXtLKLTyle6st7a1rCaREQkoUDRGZcnZw8vw+lz58x trzSWTnMQXdBDL1+2i6ELfUPAceXcTxCigGu5JR/TiO1pQd+qWomo2HeJ lqrauvKnAJ/PY1DfbF1/jjGo/Z5nx+Ow1vfN0ECb0qGtLuGYMWRYk7uBR GhN6Dz7eZ/Kao444p6kke4FqfF27RU112XRG1jhZ17j9R0If92ONLeY/b Q==; IronPort-SDR: cV8yZUQw+SbL/upJAS4T328t6SW/J4sycLqrzx7HejvDppIACraQhcL1eWJ7L+OBfbTEBSZzhR /YW36yGSBdkhlrtwEXjDdZETzTQKgODGkUg5VkEB25qSpRkRNaKwh3bwgiW4ei5h80XP4k8Ws6 WthDcCIuyO2lYdzlw6srRJNlmrFMCmRoRcdJdq5vss9WDtwmtL9RQdB1suz4G5ZZYb/30CKpZ9 cQq82JpG94m/YE6B1Qa7G1UJo8Yiqv5iAojuzGHwRFNSjsHQjUB3BURCJv8SzP8uGBKi1fc3FN Q1Q= X-IronPort-AV: E=Sophos;i="5.73,395,1583218800"; d="scan'208";a="12492405" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 May 2020 04:16:36 -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:36 -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:33 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v2 4/7] usb: gadget: udc: atmel: use 1 bank endpoints for control transfers Date: Fri, 15 May 2020 14:16:28 +0300 Message-ID: <20200515111631.31210-5-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: 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 beb7246935a8..a73b0e78a357 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -1061,6 +1061,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 Fri May 15 11:16:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Birsan X-Patchwork-Id: 11551237 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 161BB697 for ; Fri, 15 May 2020 11:16:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00A3F20759 for ; Fri, 15 May 2020 11:16:49 +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="N1SE3qlK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726438AbgEOLQq (ORCPT ); Fri, 15 May 2020 07:16:46 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:13940 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgEOLQl (ORCPT ); Fri, 15 May 2020 07:16:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589541400; x=1621077400; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=sVqWsLz1y8fsk5DdLudMe2Mg6uiTLwYXDVejGU3d/cs=; b=N1SE3qlKQy64WcnpUmc7YwLm/mVOCipxNoH5shCmY+xDgYBo8lbB+T/8 pSAPrnfazvlu26siV4qLoR8VYPYbX+QVhP48A6X1lkjXXTsV54Xvwooze cu21kEX0P+xkH2rT2KbGQW3P6sEKO7UHyftzXyUHCBcR7CjMhHo7CLlnX +7t0Y+COkVU6G/aYlo/Anl95KTSrecI6CScFQcY142Lp48lgrBTWCz5oy DLGwBD9Yb8ZJQthqVswXJuE+VQ3Yb6SBbhpO9RJsWG/9MnCms4Kn5x12/ 2XaWVZV7W8IwsMlDdgRsWjm3k0aCwHOpaES+81+vVaJgn2qJrYz2Br5bF g==; IronPort-SDR: fWQCjc6jhWyyAwjXpD3T2ZttWIy031vnoDgobbQQ55/8JQYyIN+5k5IB4xjaKm9uUESM8Sj5KB ibNBDPEkbVjcABQwUDeEr4BMuyF7zJ6O6aiNMe42XloQ9DNlaUFfuYaW1aEiP/VJw6SzVJ5+29 /D+7pBvvBqCGzJXHpvnO1oGdyjoarsjpUxpQOlKxxmnYZhLL5iOEReSw60sffxuNaXiFPCCveJ mM/PWe1raXMubak4WpKfi7JNuKhyffDlXSVCIImMWDFp4PpPrWEwCaKUCNktAM5jJTUj+IEcj7 0bQ= X-IronPort-AV: E=Sophos;i="5.73,395,1583218800"; d="scan'208";a="79770138" 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:39 -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:39 -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:36 -0700 From: To: , , , , , , , , , , CC: Cristian Birsan Subject: [PATCH v2 5/7] usb: gadget: udc: atmel: rename errata into caps Date: Fri, 15 May 2020 14:16:29 +0300 Message-ID: <20200515111631.31210-6-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: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Cristian Birsan Rename errata structure into capabilities (caps). It will be used to add capabilities for new SoCs. Get the pointer to PMC only for the SoCs that need it to perform toggle_bias or pulse_bias. Signed-off-by: Cristian Birsan --- drivers/usb/gadget/udc/atmel_usba_udc.c | 20 ++++++++++---------- drivers/usb/gadget/udc/atmel_usba_udc.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index a73b0e78a357..2b1a0b6df0fe 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -389,8 +389,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) @@ -398,8 +398,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; } @@ -2032,17 +2032,17 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc) 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, }; 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,at91sam9rl-udc", .data = &at91sam9rl_caps }, + { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps }, { .compatible = "atmel,sama5d3-udc" }, { /* sentinel */ } }; @@ -2070,8 +2070,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, if (!match) return ERR_PTR(-EINVAL); - udc->errata = match->data; - if (udc->errata) { + udc->caps = match->data; + if (udc->caps && (udc->caps->pulse_bias || udc->caps->toggle_bias)) { pp = of_find_matching_node_and_match(NULL, atmel_pmc_dt_ids, NULL); if (!pp) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index 8de79356d31d..1a0f77bf8d4f 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -302,7 +302,7 @@ 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); }; @@ -320,7 +320,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; struct gpio_desc *vbus_pin; int num_ep; 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 X-Patchwork-Id: 11551245 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 4C5CB697 for ; Fri, 15 May 2020 11:17:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34E6F204EF for ; Fri, 15 May 2020 11:17:00 +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 S1726582AbgEOLQ4 (ORCPT ); Fri, 15 May 2020 07:16:56 -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: 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 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 X-Patchwork-Id: 11551239 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 4CC31697 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 36AF12076A 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 S1726532AbgEOLQt (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: 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 | 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>;