From patchwork Fri Feb 28 02:07:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 11411381 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 46064924 for ; Fri, 28 Feb 2020 02:08:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C5A0246A2 for ; Fri, 28 Feb 2020 02:08:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Apj5qeNS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730532AbgB1CIK (ORCPT ); Thu, 27 Feb 2020 21:08:10 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41719 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgB1CIK (ORCPT ); Thu, 27 Feb 2020 21:08:10 -0500 Received: by mail-pg1-f195.google.com with SMTP id b1so657399pgm.8; Thu, 27 Feb 2020 18:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n5+f023/AFTFPRU78q67NXWfPpix42i3+SQGTMudxQo=; b=Apj5qeNSE7RPSSinJ9TPqbB1XM2gpbEDtEHtwXJ5JcOdRpEWHC2Q8X5M0Hdb0WV6fK 4ZjD7RhOnrJeZH55GFjTKEv+uEghUDFayUjpl8D5sOpFlOUpDTozeZzsQw7PlfBnRScn ebeGnE/otQI1oFbvU/h9pkNwvLlsBUdpq5FERZby3MthvLH6LCUnOPFjSxZ1HherIeRF GNg844ti1HMnHtBt1bzwrpQmqsUb9kqwu0Q8b+bgN+2Q1c4f0le6yZq7Nvfr1mF4SmIC GImHWCY3tHp1L06+Hk4+bshIonSWjb2c+k/Em6JmMvIMKy1TRiR7RQa631WmeILOIvPP QCWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n5+f023/AFTFPRU78q67NXWfPpix42i3+SQGTMudxQo=; b=dK/5j1BOvYW0bnBSdH8zjcBcpXH5lffrAIkSBdlwM+mDlMxCQQVNb5LIdDGQn3B2qR k54n8/ndpdJn+RGLYu120Dc9u1xrSqjnw51T0frWIQ5E+rmS9uNU2QRrnuRPJz5rtKsy mLx2bqTOQB6hgANcVsc43GM/L9LJaWCW+9JYd+7QhMRQShq7JsAnZIf0gIVjksPp59fs iLvCnBT07a9n79UurOl31c7GGD8OtiueCPu4P9RGhjAJDI9sXYcAwVSIyf/VL4B1Mt3t 38VirCZSuJzbjmNOKvFwhErk2vZME5sklAyVizDCkStTi49xtlT2//3nRtkWAT5lzqDQ L6kA== X-Gm-Message-State: APjAAAWxcCeCiNurxho6zbPmcGNZBhlTKeBpCok42fiptv3uwbiGNF/m fPTvLk6SUdkgj1BMOxA7T30= X-Google-Smtp-Source: APXvYqxjw2Lt8dBPAv3hg4/x9xw5qg13CnR/Pjf+dW22neLPqjXy7A4sbsByZMVkEThK5yDmBVb1qg== X-Received: by 2002:a62:3304:: with SMTP id z4mr1913213pfz.79.1582855688950; Thu, 27 Feb 2020 18:08:08 -0800 (PST) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:500::4:d8f5]) by smtp.gmail.com with ESMTPSA id k24sm4931972pgm.61.2020.02.27.18.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:08:08 -0800 (PST) From: rentao.bupt@gmail.com To: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: [PATCH v6 1/7] usb: gadget: aspeed: support per-vhub usb descriptors Date: Thu, 27 Feb 2020 18:07:51 -0800 Message-Id: <20200228020757.10513-2-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228020757.10513-1-rentao.bupt@gmail.com> References: <20200228020757.10513-1-rentao.bupt@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Tao Ren This patch store vhub's standard usb descriptors in struct "ast_vhub" so it's more convenient to customize descriptors and potentially support multiple vhub instances in the future. Signed-off-by: Tao Ren Acked-by: Benjamin Herrenschmidt --- No change in v2/v3/v4/v5/v6: - the patch is added to the patch series since v4. drivers/usb/gadget/udc/aspeed-vhub/hub.c | 43 ++++++++++++++++------- drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 15 ++++++++ 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/udc/aspeed-vhub/hub.c index 19b3517e04c0..9c3027306b15 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c @@ -93,11 +93,7 @@ static void ast_vhub_patch_dev_desc_usb1(struct usb_device_descriptor *desc) USB_DT_INTERFACE_SIZE + \ USB_DT_ENDPOINT_SIZE) -static const struct ast_vhub_full_cdesc { - struct usb_config_descriptor cfg; - struct usb_interface_descriptor intf; - struct usb_endpoint_descriptor ep; -} __attribute__ ((packed)) ast_vhub_conf_desc = { +static const struct ast_vhub_full_cdesc ast_vhub_conf_desc = { .cfg = { .bLength = USB_DT_CONFIG_SIZE, .bDescriptorType = USB_DT_CONFIG, @@ -266,6 +262,7 @@ static int ast_vhub_rep_desc(struct ast_vhub_ep *ep, u8 desc_type, u16 len) { size_t dsize; + struct ast_vhub *vhub = ep->vhub; EPDBG(ep, "GET_DESCRIPTOR(type:%d)\n", desc_type); @@ -281,20 +278,20 @@ static int ast_vhub_rep_desc(struct ast_vhub_ep *ep, switch(desc_type) { case USB_DT_DEVICE: dsize = USB_DT_DEVICE_SIZE; - memcpy(ep->buf, &ast_vhub_dev_desc, dsize); - BUILD_BUG_ON(dsize > sizeof(ast_vhub_dev_desc)); + memcpy(ep->buf, &vhub->vhub_dev_desc, dsize); + BUILD_BUG_ON(dsize > sizeof(vhub->vhub_dev_desc)); BUILD_BUG_ON(USB_DT_DEVICE_SIZE >= AST_VHUB_EP0_MAX_PACKET); break; case USB_DT_CONFIG: dsize = AST_VHUB_CONF_DESC_SIZE; - memcpy(ep->buf, &ast_vhub_conf_desc, dsize); - BUILD_BUG_ON(dsize > sizeof(ast_vhub_conf_desc)); + memcpy(ep->buf, &vhub->vhub_conf_desc, dsize); + BUILD_BUG_ON(dsize > sizeof(vhub->vhub_conf_desc)); BUILD_BUG_ON(AST_VHUB_CONF_DESC_SIZE >= AST_VHUB_EP0_MAX_PACKET); break; case USB_DT_HUB: dsize = AST_VHUB_HUB_DESC_SIZE; - memcpy(ep->buf, &ast_vhub_hub_desc, dsize); - BUILD_BUG_ON(dsize > sizeof(ast_vhub_hub_desc)); + memcpy(ep->buf, &vhub->vhub_hub_desc, dsize); + BUILD_BUG_ON(dsize > sizeof(vhub->vhub_hub_desc)); BUILD_BUG_ON(AST_VHUB_HUB_DESC_SIZE >= AST_VHUB_EP0_MAX_PACKET); break; default: @@ -317,7 +314,8 @@ static int ast_vhub_rep_string(struct ast_vhub_ep *ep, u8 string_id, u16 lang_id, u16 len) { - int rc = usb_gadget_get_string (&ast_vhub_strings, string_id, ep->buf); + int rc = usb_gadget_get_string(&ep->vhub->vhub_str_desc, + string_id, ep->buf); /* * This should never happen unless we put too big strings in @@ -834,9 +832,30 @@ void ast_vhub_hub_reset(struct ast_vhub *vhub) writel(0, vhub->regs + AST_VHUB_EP1_STS_CHG); } +static void ast_vhub_init_desc(struct ast_vhub *vhub) +{ + /* Initialize vhub Device Descriptor. */ + memcpy(&vhub->vhub_dev_desc, &ast_vhub_dev_desc, + sizeof(vhub->vhub_dev_desc)); + + /* Initialize vhub Configuration Descriptor. */ + memcpy(&vhub->vhub_conf_desc, &ast_vhub_conf_desc, + sizeof(vhub->vhub_conf_desc)); + + /* Initialize vhub Hub Descriptor. */ + memcpy(&vhub->vhub_hub_desc, &ast_vhub_hub_desc, + sizeof(vhub->vhub_hub_desc)); + + /* Initialize vhub String Descriptors. */ + memcpy(&vhub->vhub_str_desc, &ast_vhub_strings, + sizeof(vhub->vhub_str_desc)); +} + void ast_vhub_init_hub(struct ast_vhub *vhub) { vhub->speed = USB_SPEED_UNKNOWN; INIT_WORK(&vhub->wake_work, ast_vhub_wake_work); + + ast_vhub_init_desc(vhub); } diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h index 761919e220d3..191f9fae7420 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h +++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h @@ -2,6 +2,9 @@ #ifndef __ASPEED_VHUB_H #define __ASPEED_VHUB_H +#include +#include + /***************************** * * * VHUB register definitions * @@ -373,6 +376,12 @@ struct ast_vhub_port { struct ast_vhub_dev dev; }; +struct ast_vhub_full_cdesc { + struct usb_config_descriptor cfg; + struct usb_interface_descriptor intf; + struct usb_endpoint_descriptor ep; +} __packed; + /* Global vhub structure */ struct ast_vhub { struct platform_device *pdev; @@ -409,6 +418,12 @@ struct ast_vhub { /* Upstream bus speed captured at bus reset */ unsigned int speed; + + /* Standard USB Descriptors of the vhub. */ + struct usb_device_descriptor vhub_dev_desc; + struct ast_vhub_full_cdesc vhub_conf_desc; + struct usb_hub_descriptor vhub_hub_desc; + struct usb_gadget_strings vhub_str_desc; }; /* Standard request handlers result codes */ From patchwork Fri Feb 28 02:07:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 11411379 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 1E98E138D for ; Fri, 28 Feb 2020 02:08:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA14F24695 for ; Fri, 28 Feb 2020 02:08:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VByrpl2F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730610AbgB1CIM (ORCPT ); Thu, 27 Feb 2020 21:08:12 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44088 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730599AbgB1CIM (ORCPT ); Thu, 27 Feb 2020 21:08:12 -0500 Received: by mail-pf1-f196.google.com with SMTP id y5so843503pfb.11; Thu, 27 Feb 2020 18:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R96Uh6qu7rlUWNhW3u2A9Ws+WoCQilLWmWfQKQDqOPE=; b=VByrpl2Fy8lXI/UVrAFpkKzNjpmrzpVRCQpMaU2zqRJPR+iB0ATRZzCQYCOqhKLSc1 8odik49aTANZCwRTKs8VvldNYAnD+WxAqOsfaxAf90ph/TDVCPM8EA5bJMXDYwJl0gfh KaLdp5uobga8AX4ZUNZkwipMUr2ZBjD99gsaq5uUV454yg7W9b4H5Q/loYQl6a+xq+FU BBm54GF3iAejfs5GTa3y6LDL1Daj9/izDc+1I7ObWeqR4cOHljYk7A7Z1S65CIbhOOBj hWuPvb4fuUNKS2Ve6TVEGwT1yWRT3TxmWSaVGxcEucFm+SvzqEWsDz4psfpH/oY0zA/e 1vwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R96Uh6qu7rlUWNhW3u2A9Ws+WoCQilLWmWfQKQDqOPE=; b=RVBg/rww7b4I2ZCxIViB1zCAIhO1IqwApQlcc2wxRlFGWWPVdAHtLqC6byj66K/HXP N9OAdwTZL4MlZz1Aj0NHOq9apyfSb68QDLyqQZXMuVMeTWpN0q1PD1FNrNqpMFh4CNTV YFfZlKHdp1MrWx/FSKY/JRHcClPYQ6zyUVr9b0U6Quhgu+gLKWYTkMG8Z0PlaDMIM/vy Po/QduhwE67NXKJP1FbFugedR5Z2pwF1EncocCjnb+EahoKK3hQAfOMdwWg4BcmiUs1/ AYMlPYoOuOb5tYciADDa6BuVGQUPB3/EzmFh4BuSIS1DFj/36Sm713iN7CSYRrtAZEnz nUhw== X-Gm-Message-State: APjAAAXGZrOoJQkx1l+4jOZ86iaQYXs1h0gRmryup1WoRTYJRrEgYwfO x1XVHOJCyYc1Y44xfAHedz4= X-Google-Smtp-Source: APXvYqzNP4XYwR67s+b1++b/G36Lo93CSPrJd0wLDKTU0TVodiII2+nfWtG5BZxfNp5gyT3JYZUJbg== X-Received: by 2002:aa7:9aa5:: with SMTP id x5mr2042764pfi.131.1582855690555; Thu, 27 Feb 2020 18:08:10 -0800 (PST) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:500::4:d8f5]) by smtp.gmail.com with ESMTPSA id k24sm4931972pgm.61.2020.02.27.18.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:08:10 -0800 (PST) From: rentao.bupt@gmail.com To: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: [PATCH v6 2/7] usb: gadget: aspeed: read vhub properties from device tree Date: Thu, 27 Feb 2020 18:07:52 -0800 Message-Id: <20200228020757.10513-3-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228020757.10513-1-rentao.bupt@gmail.com> References: <20200228020757.10513-1-rentao.bupt@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Tao Ren The patch introduces 2 DT properties ("aspeed,vhub-downstream-ports" and "aspeed,vhub-generic-endpoints") which replaces hardcoded port/endpoint number. It is to make it more convenient to add support for newer vhub revisions with different number of ports and endpoints. Signed-off-by: Tao Ren Reviewed-by: Joel Stanley Acked-by: Benjamin Herrenschmidt --- No change in v5/v6. Changes in v4: - use NUM_PORTS/NUM_GEN_EPs defined in vhub.h instead of introducing new constants (in v3). Changes in v3: - fall back to "default" number of ports and endpoints to avoid breaking existing ast2400/ast2500 platforms when according device tree properties are not defined. Changes in v2: - removed ast_vhub_config structure and moved vhub port/endpoint number into device tree. drivers/usb/gadget/udc/aspeed-vhub/core.c | 68 ++++++++++++++--------- drivers/usb/gadget/udc/aspeed-vhub/dev.c | 30 +++++++--- drivers/usb/gadget/udc/aspeed-vhub/epn.c | 4 +- drivers/usb/gadget/udc/aspeed-vhub/hub.c | 15 ++--- drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 28 +++++----- 5 files changed, 88 insertions(+), 57 deletions(-) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c index 90b134d5dca9..f8ab8e012f34 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c @@ -99,7 +99,7 @@ static irqreturn_t ast_vhub_irq(int irq, void *data) { struct ast_vhub *vhub = data; irqreturn_t iret = IRQ_NONE; - u32 istat; + u32 i, istat; /* Stale interrupt while tearing down */ if (!vhub->ep0_bufs) @@ -121,10 +121,10 @@ static irqreturn_t ast_vhub_irq(int irq, void *data) /* Handle generic EPs first */ if (istat & VHUB_IRQ_EP_POOL_ACK_STALL) { - u32 i, ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR); + u32 ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR); writel(ep_acks, vhub->regs + AST_VHUB_EP_ACK_ISR); - for (i = 0; ep_acks && i < AST_VHUB_NUM_GEN_EPs; i++) { + for (i = 0; ep_acks && i < vhub->max_epns; i++) { u32 mask = VHUB_EP_IRQ(i); if (ep_acks & mask) { ast_vhub_epn_ack_irq(&vhub->epns[i]); @@ -134,21 +134,11 @@ static irqreturn_t ast_vhub_irq(int irq, void *data) } /* Handle device interrupts */ - if (istat & (VHUB_IRQ_DEVICE1 | - VHUB_IRQ_DEVICE2 | - VHUB_IRQ_DEVICE3 | - VHUB_IRQ_DEVICE4 | - VHUB_IRQ_DEVICE5)) { - if (istat & VHUB_IRQ_DEVICE1) - ast_vhub_dev_irq(&vhub->ports[0].dev); - if (istat & VHUB_IRQ_DEVICE2) - ast_vhub_dev_irq(&vhub->ports[1].dev); - if (istat & VHUB_IRQ_DEVICE3) - ast_vhub_dev_irq(&vhub->ports[2].dev); - if (istat & VHUB_IRQ_DEVICE4) - ast_vhub_dev_irq(&vhub->ports[3].dev); - if (istat & VHUB_IRQ_DEVICE5) - ast_vhub_dev_irq(&vhub->ports[4].dev); + for (i = 0; i < vhub->max_ports; i++) { + u32 dev_mask = VHUB_IRQ_DEVICE1 << i; + + if (istat & dev_mask) + ast_vhub_dev_irq(&vhub->ports[i].dev); } /* Handle top-level vHub EP0 interrupts */ @@ -182,7 +172,7 @@ static irqreturn_t ast_vhub_irq(int irq, void *data) void ast_vhub_init_hw(struct ast_vhub *vhub) { - u32 ctrl; + u32 ctrl, port_mask, epn_mask; UDCDBG(vhub,"(Re)Starting HW ...\n"); @@ -222,15 +212,20 @@ void ast_vhub_init_hw(struct ast_vhub *vhub) } /* Reset all devices */ - writel(VHUB_SW_RESET_ALL, vhub->regs + AST_VHUB_SW_RESET); + port_mask = GENMASK(vhub->max_ports, 1); + writel(VHUB_SW_RESET_ROOT_HUB | + VHUB_SW_RESET_DMA_CONTROLLER | + VHUB_SW_RESET_EP_POOL | + port_mask, vhub->regs + AST_VHUB_SW_RESET); udelay(1); writel(0, vhub->regs + AST_VHUB_SW_RESET); /* Disable and cleanup EP ACK/NACK interrupts */ + epn_mask = GENMASK(vhub->max_epns - 1, 0); writel(0, vhub->regs + AST_VHUB_EP_ACK_IER); writel(0, vhub->regs + AST_VHUB_EP_NACK_IER); - writel(VHUB_EP_IRQ_ALL, vhub->regs + AST_VHUB_EP_ACK_ISR); - writel(VHUB_EP_IRQ_ALL, vhub->regs + AST_VHUB_EP_NACK_ISR); + writel(epn_mask, vhub->regs + AST_VHUB_EP_ACK_ISR); + writel(epn_mask, vhub->regs + AST_VHUB_EP_NACK_ISR); /* Default settings for EP0, enable HW hub EP1 */ writel(0, vhub->regs + AST_VHUB_EP0_CTRL); @@ -273,7 +268,7 @@ static int ast_vhub_remove(struct platform_device *pdev) return 0; /* Remove devices */ - for (i = 0; i < AST_VHUB_NUM_PORTS; i++) + for (i = 0; i < vhub->max_ports; i++) ast_vhub_del_dev(&vhub->ports[i].dev); spin_lock_irqsave(&vhub->lock, flags); @@ -295,7 +290,7 @@ static int ast_vhub_remove(struct platform_device *pdev) if (vhub->ep0_bufs) dma_free_coherent(&pdev->dev, AST_VHUB_EP0_MAX_PACKET * - (AST_VHUB_NUM_PORTS + 1), + (vhub->max_ports + 1), vhub->ep0_bufs, vhub->ep0_bufs_dma); vhub->ep0_bufs = NULL; @@ -309,11 +304,32 @@ static int ast_vhub_probe(struct platform_device *pdev) struct ast_vhub *vhub; struct resource *res; int i, rc = 0; + const struct device_node *np = pdev->dev.of_node; vhub = devm_kzalloc(&pdev->dev, sizeof(*vhub), GFP_KERNEL); if (!vhub) return -ENOMEM; + rc = of_property_read_u32(np, "aspeed,vhub-downstream-ports", + &vhub->max_ports); + if (rc < 0) + vhub->max_ports = AST_VHUB_NUM_PORTS; + + vhub->ports = devm_kcalloc(&pdev->dev, vhub->max_ports, + sizeof(*vhub->ports), GFP_KERNEL); + if (!vhub->ports) + return -ENOMEM; + + rc = of_property_read_u32(np, "aspeed,vhub-generic-endpoints", + &vhub->max_epns); + if (rc < 0) + vhub->max_epns = AST_VHUB_NUM_GEN_EPs; + + vhub->epns = devm_kcalloc(&pdev->dev, vhub->max_epns, + sizeof(*vhub->epns), GFP_KERNEL); + if (!vhub->epns) + return -ENOMEM; + spin_lock_init(&vhub->lock); vhub->pdev = pdev; @@ -366,7 +382,7 @@ static int ast_vhub_probe(struct platform_device *pdev) */ vhub->ep0_bufs = dma_alloc_coherent(&pdev->dev, AST_VHUB_EP0_MAX_PACKET * - (AST_VHUB_NUM_PORTS + 1), + (vhub->max_ports + 1), &vhub->ep0_bufs_dma, GFP_KERNEL); if (!vhub->ep0_bufs) { dev_err(&pdev->dev, "Failed to allocate EP0 DMA buffers\n"); @@ -380,7 +396,7 @@ static int ast_vhub_probe(struct platform_device *pdev) ast_vhub_init_ep0(vhub, &vhub->ep0, NULL); /* Init devices */ - for (i = 0; i < AST_VHUB_NUM_PORTS && rc == 0; i++) + for (i = 0; i < vhub->max_ports && rc == 0; i++) rc = ast_vhub_init_dev(vhub, i); if (rc) goto err; diff --git a/drivers/usb/gadget/udc/aspeed-vhub/dev.c b/drivers/usb/gadget/udc/aspeed-vhub/dev.c index 4008e7a51188..d268306a7bfe 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/dev.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/dev.c @@ -77,7 +77,7 @@ static void ast_vhub_dev_enable(struct ast_vhub_dev *d) writel(d->ep0.buf_dma, d->regs + AST_VHUB_DEV_EP0_DATA); /* Clear stall on all EPs */ - for (i = 0; i < AST_VHUB_NUM_GEN_EPs; i++) { + for (i = 0; i < d->max_epns; i++) { struct ast_vhub_ep *ep = d->epns[i]; if (ep && (ep->epn.stalled || ep->epn.wedged)) { @@ -137,7 +137,7 @@ static int ast_vhub_ep_feature(struct ast_vhub_dev *d, is_set ? "SET" : "CLEAR", ep_num, wValue); if (ep_num == 0) return std_req_complete; - if (ep_num >= AST_VHUB_NUM_GEN_EPs || !d->epns[ep_num - 1]) + if (ep_num >= d->max_epns || !d->epns[ep_num - 1]) return std_req_stall; if (wValue != USB_ENDPOINT_HALT) return std_req_driver; @@ -181,7 +181,7 @@ static int ast_vhub_ep_status(struct ast_vhub_dev *d, DDBG(d, "GET_STATUS(ep%d)\n", ep_num); - if (ep_num >= AST_VHUB_NUM_GEN_EPs) + if (ep_num >= d->max_epns) return std_req_stall; if (ep_num != 0) { ep = d->epns[ep_num - 1]; @@ -299,7 +299,7 @@ static void ast_vhub_dev_nuke(struct ast_vhub_dev *d) { unsigned int i; - for (i = 0; i < AST_VHUB_NUM_GEN_EPs; i++) { + for (i = 0; i < d->max_epns; i++) { if (!d->epns[i]) continue; ast_vhub_nuke(d->epns[i], -ESHUTDOWN); @@ -416,10 +416,10 @@ static struct usb_ep *ast_vhub_udc_match_ep(struct usb_gadget *gadget, * that will allow the generic code to use our * assigned address. */ - for (i = 0; i < AST_VHUB_NUM_GEN_EPs; i++) + for (i = 0; i < d->max_epns; i++) if (d->epns[i] == NULL) break; - if (i >= AST_VHUB_NUM_GEN_EPs) + if (i >= d->max_epns) return NULL; addr = i + 1; @@ -526,6 +526,7 @@ void ast_vhub_del_dev(struct ast_vhub_dev *d) usb_del_gadget_udc(&d->gadget); device_unregister(d->port_dev); + kfree(d->epns); } static void ast_vhub_dev_release(struct device *dev) @@ -546,14 +547,25 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx) ast_vhub_init_ep0(vhub, &d->ep0, d); + /* + * A USB device can have up to 30 endpoints besides control + * endpoint 0. + */ + d->max_epns = min_t(u32, vhub->max_epns, 30); + d->epns = kcalloc(d->max_epns, sizeof(*d->epns), GFP_KERNEL); + if (!d->epns) + return -ENOMEM; + /* * The UDC core really needs us to have separate and uniquely * named "parent" devices for each port so we create a sub device * here for that purpose */ d->port_dev = kzalloc(sizeof(struct device), GFP_KERNEL); - if (!d->port_dev) - return -ENOMEM; + if (!d->port_dev) { + rc = -ENOMEM; + goto fail_alloc; + } device_initialize(d->port_dev); d->port_dev->release = ast_vhub_dev_release; d->port_dev->parent = parent; @@ -584,6 +596,8 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx) device_del(d->port_dev); fail_add: put_device(d->port_dev); + fail_alloc: + kfree(d->epns); return rc; } diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c index 7475c74aa5c5..0bd6b20435b8 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c @@ -800,10 +800,10 @@ struct ast_vhub_ep *ast_vhub_alloc_epn(struct ast_vhub_dev *d, u8 addr) /* Find a free one (no device) */ spin_lock_irqsave(&vhub->lock, flags); - for (i = 0; i < AST_VHUB_NUM_GEN_EPs; i++) + for (i = 0; i < vhub->max_epns; i++) if (vhub->epns[i].dev == NULL) break; - if (i >= AST_VHUB_NUM_GEN_EPs) { + if (i >= vhub->max_epns) { spin_unlock_irqrestore(&vhub->lock, flags); return NULL; } diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/udc/aspeed-vhub/hub.c index 9c3027306b15..6e565c3dbb5b 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c @@ -502,7 +502,7 @@ static void ast_vhub_wake_work(struct work_struct *work) * we let the normal host wake path deal with it later. */ spin_lock_irqsave(&vhub->lock, flags); - for (i = 0; i < AST_VHUB_NUM_PORTS; i++) { + for (i = 0; i < vhub->max_ports; i++) { struct ast_vhub_port *p = &vhub->ports[i]; if (!(p->status & USB_PORT_STAT_SUSPEND)) @@ -585,7 +585,7 @@ static enum std_req_rc ast_vhub_set_port_feature(struct ast_vhub_ep *ep, struct ast_vhub *vhub = ep->vhub; struct ast_vhub_port *p; - if (port == 0 || port > AST_VHUB_NUM_PORTS) + if (port == 0 || port > vhub->max_ports) return std_req_stall; port--; p = &vhub->ports[port]; @@ -628,7 +628,7 @@ static enum std_req_rc ast_vhub_clr_port_feature(struct ast_vhub_ep *ep, struct ast_vhub *vhub = ep->vhub; struct ast_vhub_port *p; - if (port == 0 || port > AST_VHUB_NUM_PORTS) + if (port == 0 || port > vhub->max_ports) return std_req_stall; port--; p = &vhub->ports[port]; @@ -674,7 +674,7 @@ static enum std_req_rc ast_vhub_get_port_stat(struct ast_vhub_ep *ep, struct ast_vhub *vhub = ep->vhub; u16 stat, chg; - if (port == 0 || port > AST_VHUB_NUM_PORTS) + if (port == 0 || port > vhub->max_ports) return std_req_stall; port--; @@ -755,7 +755,7 @@ void ast_vhub_hub_suspend(struct ast_vhub *vhub) * Forward to unsuspended ports without changing * their connection status. */ - for (i = 0; i < AST_VHUB_NUM_PORTS; i++) { + for (i = 0; i < vhub->max_ports; i++) { struct ast_vhub_port *p = &vhub->ports[i]; if (!(p->status & USB_PORT_STAT_SUSPEND)) @@ -778,7 +778,7 @@ void ast_vhub_hub_resume(struct ast_vhub *vhub) * Forward to unsuspended ports without changing * their connection status. */ - for (i = 0; i < AST_VHUB_NUM_PORTS; i++) { + for (i = 0; i < vhub->max_ports; i++) { struct ast_vhub_port *p = &vhub->ports[i]; if (!(p->status & USB_PORT_STAT_SUSPEND)) @@ -812,7 +812,7 @@ void ast_vhub_hub_reset(struct ast_vhub *vhub) * Clear all port status, disable gadgets and "suspend" * them. They will be woken up by a port reset. */ - for (i = 0; i < AST_VHUB_NUM_PORTS; i++) { + for (i = 0; i < vhub->max_ports; i++) { struct ast_vhub_port *p = &vhub->ports[i]; /* Only keep the connected flag */ @@ -845,6 +845,7 @@ static void ast_vhub_init_desc(struct ast_vhub *vhub) /* Initialize vhub Hub Descriptor. */ memcpy(&vhub->vhub_hub_desc, &ast_vhub_hub_desc, sizeof(vhub->vhub_hub_desc)); + vhub->vhub_hub_desc.bNbrPorts = vhub->max_ports; /* Initialize vhub String Descriptors. */ memcpy(&vhub->vhub_str_desc, &ast_vhub_strings, diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h index 191f9fae7420..fac79ef6d669 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h +++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h @@ -79,17 +79,9 @@ #define VHUB_SW_RESET_DEVICE2 (1 << 2) #define VHUB_SW_RESET_DEVICE1 (1 << 1) #define VHUB_SW_RESET_ROOT_HUB (1 << 0) -#define VHUB_SW_RESET_ALL (VHUB_SW_RESET_EP_POOL | \ - VHUB_SW_RESET_DMA_CONTROLLER | \ - VHUB_SW_RESET_DEVICE5 | \ - VHUB_SW_RESET_DEVICE4 | \ - VHUB_SW_RESET_DEVICE3 | \ - VHUB_SW_RESET_DEVICE2 | \ - VHUB_SW_RESET_DEVICE1 | \ - VHUB_SW_RESET_ROOT_HUB) + /* EP ACK/NACK IRQ masks */ #define VHUB_EP_IRQ(n) (1 << (n)) -#define VHUB_EP_IRQ_ALL 0x7fff /* 15 EPs */ /* USB status reg */ #define VHUB_USBSTS_HISPEED (1 << 27) @@ -213,6 +205,11 @@ * * ****************************************/ +/* + * AST_VHUB_NUM_GEN_EPs and AST_VHUB_NUM_PORTS are kept to avoid breaking + * existing AST2400/AST2500 platforms. AST2600 and future vhub revisions + * should define number of downstream ports and endpoints in device tree. + */ #define AST_VHUB_NUM_GEN_EPs 15 /* Generic non-0 EPs */ #define AST_VHUB_NUM_PORTS 5 /* vHub ports */ #define AST_VHUB_EP0_MAX_PACKET 64 /* EP0's max packet size */ @@ -315,7 +312,7 @@ struct ast_vhub_ep { /* Registers */ void __iomem *regs; - /* Index in global pool (0..14) */ + /* Index in global pool (zero-based) */ unsigned int g_idx; /* DMA Descriptors */ @@ -345,7 +342,7 @@ struct ast_vhub_dev { struct ast_vhub *vhub; void __iomem *regs; - /* Device index (0...4) and name string */ + /* Device index (zero-based) and name string */ unsigned int index; const char *name; @@ -361,7 +358,8 @@ struct ast_vhub_dev { /* Endpoint structures */ struct ast_vhub_ep ep0; - struct ast_vhub_ep *epns[AST_VHUB_NUM_GEN_EPs]; + struct ast_vhub_ep **epns; + u32 max_epns; }; #define to_ast_dev(__g) container_of(__g, struct ast_vhub_dev, gadget) @@ -402,10 +400,12 @@ struct ast_vhub { bool ep1_stalled : 1; /* Per-port info */ - struct ast_vhub_port ports[AST_VHUB_NUM_PORTS]; + struct ast_vhub_port *ports; + u32 max_ports; /* Generic EP data structures */ - struct ast_vhub_ep epns[AST_VHUB_NUM_GEN_EPs]; + struct ast_vhub_ep *epns; + u32 max_epns; /* Upstream bus is suspended ? */ bool suspended : 1; From patchwork Fri Feb 28 02:07:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 11411377 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 92427138D for ; Fri, 28 Feb 2020 02:08:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 70E73246A2 for ; Fri, 28 Feb 2020 02:08:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZX+VZBI9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730638AbgB1CIN (ORCPT ); Thu, 27 Feb 2020 21:08:13 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37068 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgB1CIN (ORCPT ); Thu, 27 Feb 2020 21:08:13 -0500 Received: by mail-pg1-f196.google.com with SMTP id z12so670398pgl.4; Thu, 27 Feb 2020 18:08:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4mjPmvXysWT0DgB3PSQGnyz6HfpRACYycHeQnWkOz6Y=; b=ZX+VZBI9RskmB38Sd4RrA9/Aek92Spv7yQBdBSNLRoSEFNRURWgTZE11IoKdjOZ3YK PGTlTDyR8NTYR1vcoWariC/tTjag+7sxf8YW+rk/DcYghR05j5n+ThZTm8AjLUAWsf+g mFCkQAz4hd1zRFWqdRgwUUgNLsRq6ztHgVWHvB7RVUKj7e+NNLnxVuI+LXwl58RhQyMM C0ZuJTShk4JZqg5OsJaVIZ6xUdVXOWqff9hkmcjsftTwAYUIan8B/5r/e0oRS3ts714o eK39VCi2cDLhZ+epNfi/Q/heRRxkFVXJzWlDWJH5vKB02rkr5U2AVlfW2YkKlQVbssoB yT5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4mjPmvXysWT0DgB3PSQGnyz6HfpRACYycHeQnWkOz6Y=; b=hLXV6rqIHS2bCRdwfB7qMjr+fA6/V7yWf09K/+ni2lHwqS0+Eq1SeaUVaw/Ye/OiLd EiCCW6XXa1SWp8W7uzcLwvtkqb6Yro9q44bcQd1qYHhSilq9MjyJwxmneQ9Ooy+oRNbl gGHYJ04j5rctFM9xgbAmbJmsqfNI/T3jTMYdrxdqJ+A1JBcsFWSg9xavh7BJx608XM6T 3RLDatRJGi7wWXOJuL9FrHkC+wh9yrN+BCYeGEunJqnZ+V+e/6ypXGYPGyeBA85f8Omj mC56fSplSR6MD8TAHpE0i1T9kvf3eWTibaEprRZiV3q3RGXS/mU2DiEmFnvfW00hkODg zOhQ== X-Gm-Message-State: APjAAAX0vMHmWYyVSop29cjxOZdoNJjJA8475x7dSsPhIskeB0PwuqM0 lOUW5TaA4fa8JlNZdBZrHsY= X-Google-Smtp-Source: APXvYqzqI7BYR2+TRO/7IrXywoRFNx++mQlKf8rK68vX1Z5bE2FjZLKQ+AuBDWczldPe6WJ5gntoLw== X-Received: by 2002:a62:1dca:: with SMTP id d193mr2085368pfd.140.1582855692123; Thu, 27 Feb 2020 18:08:12 -0800 (PST) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:500::4:d8f5]) by smtp.gmail.com with ESMTPSA id k24sm4931972pgm.61.2020.02.27.18.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:08:11 -0800 (PST) From: rentao.bupt@gmail.com To: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: [PATCH v6 3/7] usb: gadget: aspeed: add ast2600 vhub support Date: Thu, 27 Feb 2020 18:07:53 -0800 Message-Id: <20200228020757.10513-4-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228020757.10513-1-rentao.bupt@gmail.com> References: <20200228020757.10513-1-rentao.bupt@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Tao Ren Add AST2600 support in aspeed-vhub driver. There are 3 major differences between AST2500 and AST2600 vhub: - AST2600 supports 7 downstream ports while AST2500 supports 5. - AST2600 supports 21 generic endpoints while AST2500 supports 15. - EP0 data buffer's 8-byte DMA alignment restriction is removed from AST2600. Signed-off-by: Tao Ren Reviewed-by: Andrew Jeffery Acked-by: Benjamin Herrenschmidt --- No Change in v3/v4/v5/v6. Changes in v2: - removed "ast_vhub_config" related logic. drivers/usb/gadget/udc/aspeed-vhub/Kconfig | 4 ++-- drivers/usb/gadget/udc/aspeed-vhub/core.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig index 83ba8a2eb6af..605500b19cf3 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig +++ b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig @@ -4,5 +4,5 @@ config USB_ASPEED_VHUB depends on ARCH_ASPEED || COMPILE_TEST depends on USB_LIBCOMPOSITE help - USB peripheral controller for the Aspeed AST2500 family - SoCs supporting the "vHub" functionality and USB2.0 + USB peripheral controller for the Aspeed AST2400, AST2500 and + AST2600 family SoCs supporting the "vHub" functionality and USB2.0 diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c index f8ab8e012f34..f8d35dd60c34 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c @@ -423,6 +423,9 @@ static const struct of_device_id ast_vhub_dt_ids[] = { { .compatible = "aspeed,ast2500-usb-vhub", }, + { + .compatible = "aspeed,ast2600-usb-vhub", + }, { } }; MODULE_DEVICE_TABLE(of, ast_vhub_dt_ids); From patchwork Fri Feb 28 02:07:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 11411375 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 85041924 for ; Fri, 28 Feb 2020 02:08:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65AF9246A3 for ; Fri, 28 Feb 2020 02:08:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z1ZB3TRk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730668AbgB1CIP (ORCPT ); Thu, 27 Feb 2020 21:08:15 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39105 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgB1CIP (ORCPT ); Thu, 27 Feb 2020 21:08:15 -0500 Received: by mail-pf1-f193.google.com with SMTP id l7so854694pff.6; Thu, 27 Feb 2020 18:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z5BfOwLn24yvtIE0e0iNKJsx3NaZL6cHt2dZJZg1w+Y=; b=Z1ZB3TRkP9NyXosyv0V9Jpv45jz0nTrP8690jhwQdAaqR4GfMSQMylzM1DMC3MJ0S4 TR6c3i+3RQO4KOBsqutoeF0TVEfVWHSi4rnOpnq23u/Kk5IUOt6nxFTaQmmYTqMH6lWl 4SRalwA2yv1e0SEBRYuKbJwZ7haa81rNQY0pg5CXMizf/3CO5UqeUI560n+ljt45mXXi TB7bh6SZBfAEUCg7WQ82GPMV5Yss16z2u620qIL/J/2nhYdBCqHafcEoGg0wsz6ujDk/ CTPz7pvnz3KE1RU6RlUrwTC7dbdgRwu/xO0wwYSl+eqcceai0VmuTdzrNtMw8NGhYee3 y42w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z5BfOwLn24yvtIE0e0iNKJsx3NaZL6cHt2dZJZg1w+Y=; b=HUMurObkHvJ25/q/Z51oiujphbCiD3BJOfG1psdIQFJ1fz452KoDLC01Uh9ZWcrwgO i0o2gGrPnCJD7JcENCWiHM4jqsRWW2KZRCd6Q008mAlTC+8TfHPKT6JJq37q9AboYTR6 RIyuxcxFU8vw/23cjqWTbqUl2sFa2K6bNmyhMFy1wyWWhU+lWitSB8k89LmgbHUWVAcF FDMVrHvQUno01JB1guB6rMGYpNxaMDs3MedgQRDBxEXU79SSf3/0UkGaYd7wUYHG5zp+ c5+1+jI6Ma4dRaF+wOCqvDX83yMen2plzrL6sGfGuS6xYqTw3D+HGvt/VvsoWNSl0d1v 8GbQ== X-Gm-Message-State: APjAAAVp3jiyI/q55i8kHnhInzxKI3MWUvNryr4gRE18BQu4i0/t8Iup bOjRUZ7D8eY5fVVJM6t8t18= X-Google-Smtp-Source: APXvYqxQSv9GvVWs7XjlCA2xwI/xPuFEG7LBg5g6iIOje1WR0bgOkhLW4rcGdmv8Xn/kC6GUaiJtfw== X-Received: by 2002:aa7:951c:: with SMTP id b28mr1961347pfp.97.1582855693677; Thu, 27 Feb 2020 18:08:13 -0800 (PST) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:500::4:d8f5]) by smtp.gmail.com with ESMTPSA id k24sm4931972pgm.61.2020.02.27.18.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:08:13 -0800 (PST) From: rentao.bupt@gmail.com To: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: [PATCH v6 4/7] ARM: dts: aspeed-g6: add usb functions Date: Thu, 27 Feb 2020 18:07:54 -0800 Message-Id: <20200228020757.10513-5-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228020757.10513-1-rentao.bupt@gmail.com> References: <20200228020757.10513-1-rentao.bupt@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Tao Ren Add USB components and according pin groups in aspeed-g6 dtsi. Signed-off-by: Tao Ren Reviewed-by: Andrew Jeffery Acked-by: Benjamin Herrenschmidt Reviewed-by: Joel Stanley --- No change in v3/v4/v5/v6. Changes in v2: - added port/endpoint properties for vhub dt node. arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 25 +++++++++++++ arch/arm/boot/dts/aspeed-g6.dtsi | 45 ++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi index 045ce66ca876..7028e21bdd98 100644 --- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi +++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi @@ -1112,6 +1112,31 @@ groups = "UART9"; }; + pinctrl_usb2ah_default: usb2ah_default { + function = "USB2AH"; + groups = "USBA"; + }; + + pinctrl_usb2ad_default: usb2ad_default { + function = "USB2AD"; + groups = "USBA"; + }; + + pinctrl_usb2bh_default: usb2bh_default { + function = "USB2BH"; + groups = "USBB"; + }; + + pinctrl_usb2bd_default: usb2bd_default { + function = "USB2BD"; + groups = "USBB"; + }; + + pinctrl_usb11bhid_default: usb11bhid_default { + function = "USB11BHID"; + groups = "USBB"; + }; + pinctrl_vb_default: vb_default { function = "VB"; groups = "VB"; diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi index 796976d275e1..0a29b3b57a9d 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -245,6 +245,51 @@ status = "disabled"; }; + ehci0: usb@1e6a1000 { + compatible = "aspeed,ast2600-ehci", "generic-ehci"; + reg = <0x1e6a1000 0x100>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb2ah_default>; + status = "disabled"; + }; + + ehci1: usb@1e6a3000 { + compatible = "aspeed,ast2600-ehci", "generic-ehci"; + reg = <0x1e6a3000 0x100>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_USBPORT2CLK>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb2bh_default>; + status = "disabled"; + }; + + uhci: usb@1e6b0000 { + compatible = "aspeed,ast2600-uhci", "generic-uhci"; + reg = <0x1e6b0000 0x100>; + interrupts = ; + #ports = <2>; + clocks = <&syscon ASPEED_CLK_GATE_USBUHCICLK>; + status = "disabled"; + /* + * No default pinmux, it will follow EHCI, use an + * explicit pinmux override if EHCI is not enabled. + */ + }; + + vhub: usb-vhub@1e6a0000 { + compatible = "aspeed,ast2600-usb-vhub"; + reg = <0x1e6a0000 0x350>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>; + aspeed,vhub-downstream-ports = <7>; + aspeed,vhub-generic-endpoints = <21>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb2ad_default>; + status = "disabled"; + }; + apb { compatible = "simple-bus"; #address-cells = <1>; From patchwork Fri Feb 28 02:07:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 11411373 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 BAF9C138D for ; Fri, 28 Feb 2020 02:08:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99F2A24695 for ; Fri, 28 Feb 2020 02:08:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UZutASD0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730695AbgB1CIR (ORCPT ); Thu, 27 Feb 2020 21:08:17 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41728 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgB1CIQ (ORCPT ); Thu, 27 Feb 2020 21:08:16 -0500 Received: by mail-pg1-f194.google.com with SMTP id b1so657538pgm.8; Thu, 27 Feb 2020 18:08:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S4kJGuEJfAjfPYh/Ew20Fs75jjdr/lDPxEC7XvHdiQ4=; b=UZutASD0HqaUsmZQ28/j4nBb0ea4qnMjWg42ddLNpUQYkPvicXpWWaj+s0HbQjY6UE rcOytnas6HACXzfJ5qU6ObxXqRQdL4vZJPEIQDJlMXPh+LU6m2g3a1iL2d26ImThm4dn V9pDMYHqNXEWA7T7Lm+c3vITxW0NmH0bUckrlby8M4g2CZY3uwbLeyJfqQFZhMWHwXa+ ZiMNMP/6oZd7iVbJd8WKby+deNCmiz/TqUzsw79RXaWJ5k4dVQhcp4skiqJXB2AOyANz cM7IopAYZcZxoAY9bFG9vt/ENAhgu70gjFRm7ILiD8A5xlaPqo3BGudTld5x6mE9Lg4f INLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S4kJGuEJfAjfPYh/Ew20Fs75jjdr/lDPxEC7XvHdiQ4=; b=cHqDuClVePguBx831lqcTN16r4YwGAjV/Cefmps+iRnpwE641cR3AvgH5NoOO9KsVF 5jKevTFq1GuJh9EWVVrAN0LE2kcZx43esyKekI9CxCXMUFNacCygz5xEfqq0UMqu7GdQ hxjzbu8xg9mIGJxxD0LSp7QuMNWxy96ydlUJSRt8GyXXMopwlq8PUu/HBO/pd7Q+QM+J BcT9sk2qmG+NCUuMoeRDPcRXgj7Z0g60URbqn6YlPNRXP90jwKYTKrsMTnYAGCxdsLk9 HSbmuM6RfVtW0Fa4zdUuhFgM7SOeHzPZNHEX6+DGWdbFcGoi5GHUblA1SZquxF2FtsGH XYNg== X-Gm-Message-State: APjAAAWlpcqgBvNq4DL3B055AWwHGZz6ugAnjcoVnsLV5Fz8ccxzAZgA 5bqrRBEVmMgJi4tUy+ngk8A= X-Google-Smtp-Source: APXvYqyyuwzFsaoesPovGGYPfNjv0U27sfwo1cNSj3VSdjUokF67ekm0yo1YUh2GET9uSjk0VZpl5w== X-Received: by 2002:a62:f251:: with SMTP id y17mr2111805pfl.204.1582855695286; Thu, 27 Feb 2020 18:08:15 -0800 (PST) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:500::4:d8f5]) by smtp.gmail.com with ESMTPSA id k24sm4931972pgm.61.2020.02.27.18.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:08:14 -0800 (PST) From: rentao.bupt@gmail.com To: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: [PATCH v6 5/7] ARM: dts: aspeed-g5: add vhub port and endpoint properties Date: Thu, 27 Feb 2020 18:07:55 -0800 Message-Id: <20200228020757.10513-6-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228020757.10513-1-rentao.bupt@gmail.com> References: <20200228020757.10513-1-rentao.bupt@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Tao Ren Add "aspeed,vhub-downstream-ports" and "aspeed,vhub-generic-endpoints" properties to describe supported number of vhub ports and endpoints. Signed-off-by: Tao Ren Acked-by: Benjamin Herrenschmidt Reviewed-by: Joel Stanley --- No change in v2/v3/v4/v5/v6. - It's given v6 to align with the version of the patch series. arch/arm/boot/dts/aspeed-g5.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi index ebec0fa8baa7..f12ec04d3cbc 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -195,6 +195,8 @@ reg = <0x1e6a0000 0x300>; interrupts = <5>; clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>; + aspeed,vhub-downstream-ports = <5>; + aspeed,vhub-generic-endpoints = <15>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usb2ad_default>; status = "disabled"; From patchwork Fri Feb 28 02:07:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 11411367 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 E3F1D924 for ; Fri, 28 Feb 2020 02:08:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C36782469F for ; Fri, 28 Feb 2020 02:08:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SsXX5/OH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730749AbgB1CIV (ORCPT ); Thu, 27 Feb 2020 21:08:21 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33163 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730725AbgB1CIT (ORCPT ); Thu, 27 Feb 2020 21:08:19 -0500 Received: by mail-pg1-f196.google.com with SMTP id 6so678809pgk.0; Thu, 27 Feb 2020 18:08:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KBdWDv5pYXspLR13NXBmBo0uH7q/9EYA/+sUUf6ZaRY=; b=SsXX5/OHRxtFZBMPk+LSluP8pZ7Y9dSJwSdFjdsQ80SwwOz3PxCnoxWVzleXsMoGxF gSI7TSegZgM1u3WdoU7qoJeuZfa3E2knlnq3WrQe9htu5pDCLsE1ehOgr49Y3HjHam/l WyOuABtyMjV7r3eKfkmamImeNnouIYocfrHMLmHbVcArYjEb7sXXfUPPH5TiKmYt/A3l tbSYDZ35yVJHYn2ywo2Ijzwe9w8I0uA7idDbvMiaZGhcK5ZRL/Mu5LCXxd0ubjKiMFqW mPu6b9SHKUnGOw2zymloTzshoKxgIqB9whnDUBoII0T59anuNb6UZmQ9W52UkGDBtJz0 7foQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KBdWDv5pYXspLR13NXBmBo0uH7q/9EYA/+sUUf6ZaRY=; b=WTK4Iogaot3jBJ0boO/C6906gIHt8p+oczjX72CrRjA2jZAdaax94wWA8h61JBbFdy 7LiZXwN9kfDG1rwhKZ4uyNlLRsvKyt965UesYx+pFfY6pxbJlgnvvEp5ljC7fDwLtqLG BXe/qgw9MPJ2UpGsYHiQKT16PvJYKksU0SxwdEn8JjT6yN6TfuUra89h6iKRx+YMG8hW wiWrvGcmgvcVP2EZgzN1dnTWy7Lghzyp9UswCGwYSU+xnvnX+wzsi/ABuzA6R6jRiSil MK/zaqM4oioE6cU4t8/qdO+Zl2yIlNSKJUjav9WS5AgXxNVZYpWhS4psgXtaWytVlb2L DkAw== X-Gm-Message-State: APjAAAXqw1H9R47sVPxnombfQnFUJeiRgQ5i+fb+M/zssQ9G7Q1sYAL2 iiCKWRGszHiq9e9DwQBcULQ= X-Google-Smtp-Source: APXvYqwNeplEU5l3T+Bd+pYaCQcv8MrZ31vZLAMzGT+6bg15sdUb7fvXhnVpEI58PdviDIh3DOVyoA== X-Received: by 2002:a63:505b:: with SMTP id q27mr2214730pgl.39.1582855696830; Thu, 27 Feb 2020 18:08:16 -0800 (PST) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:500::4:d8f5]) by smtp.gmail.com with ESMTPSA id k24sm4931972pgm.61.2020.02.27.18.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:08:16 -0800 (PST) From: rentao.bupt@gmail.com To: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: [PATCH v6 6/7] ARM: dts: aspeed-g4: add vhub port and endpoint properties Date: Thu, 27 Feb 2020 18:07:56 -0800 Message-Id: <20200228020757.10513-7-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228020757.10513-1-rentao.bupt@gmail.com> References: <20200228020757.10513-1-rentao.bupt@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Tao Ren Add "aspeed,vhub-downstream-ports" and "aspeed,vhub-generic-endpoints" properties to describe supported number of vhub ports and endpoints. Signed-off-by: Tao Ren Acked-by: Benjamin Herrenschmidt Reviewed-by: Joel Stanley --- No change in v2/v3/v4/v5/v6. - It's given v6 to align with the version of the patch series. arch/arm/boot/dts/aspeed-g4.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi index 807a0fc20670..8e04303e8514 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi @@ -164,6 +164,8 @@ reg = <0x1e6a0000 0x300>; interrupts = <5>; clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>; + aspeed,vhub-downstream-ports = <5>; + aspeed,vhub-generic-endpoints = <15>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usb2d_default>; status = "disabled"; From patchwork Fri Feb 28 02:07:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 11411369 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 22A9114E3 for ; Fri, 28 Feb 2020 02:08:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED38F24695 for ; Fri, 28 Feb 2020 02:08:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YI6/hC9Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730756AbgB1CIW (ORCPT ); Thu, 27 Feb 2020 21:08:22 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34067 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730736AbgB1CIT (ORCPT ); Thu, 27 Feb 2020 21:08:19 -0500 Received: by mail-pf1-f196.google.com with SMTP id i6so867634pfc.1; Thu, 27 Feb 2020 18:08:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HzRU1ozCvifY6J0qAE+2jJ3JxrolEuTI7i1JJUCoGUo=; b=YI6/hC9QKIEOCJfin3HMlh8X26S+gmWpoljYrsp/+kCsAb5ir2WHqgMSFrGpTREtwb 8DqrGWac5OL8FpQLWvMOhEzKTDnYaAD92uNBRbSaLf5rhLL/rfew1PFnrNxzc7oYl4qR BEwGzY6tz8CcJCnYvCBQQTwujMCXh4xLtoeJ18JcfN+f4JKWXcvGNcdkSd/32wWyEszt unhgU7Pn6LggVceSkv4s4DKwutWAfGvuU3TUh+Y63Zv21n00DDsLThbpxVGGbnTFEE1z OeFLO/ld8L0cirWMj8c34EljgUdOPpJICm6mqeCfk8p3usXK6ybcagzev63ULVukzszI sY1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HzRU1ozCvifY6J0qAE+2jJ3JxrolEuTI7i1JJUCoGUo=; b=UfvdI/EB8s9nysr6qS4smW/jYj7LvbeX1LfBskloQ7H7WwL6mXHuRvCEL9Ztjl6Iyh W3AvoYGBC2UmtMxkuopsW6rCLfujURDzQ4Cn/FwOVlpb1uGT42d3Lsc25NPosLMnfV4w Fo2tKteP/ow+zxeiDucSwqqsrWPf9Onpe3XbuOFBcRzPJq9ofxp/oaHHJy8fha74B4V2 MAjeZgsM0iMHnedc+TFWTlbs3ZoDWPDcfAOwtvz5EtBcUhDP0gxVJmUgQncsoiFE04BQ UB7t8N6/v4RCX0FpZHFLZgJwAxEytwa+0uAj6ijY59SyI2AaOpkMLp4MhDRQ1jbstJyd ouOQ== X-Gm-Message-State: APjAAAVVcZMCpP+aUqI4Ew6Ai/RwMKe4Cpzxr58gZAZHsqeltahYU7Jg Pa+wObg8JKXHAZpLO4KUZxY= X-Google-Smtp-Source: APXvYqzEapSR5PYlZurH/fZd0sgRbV4yjSDTqL9wZDaOn6xcciN6vCo7au9H0aRrNsNl+cJuMWCrxw== X-Received: by 2002:a62:1958:: with SMTP id 85mr1930027pfz.221.1582855698458; Thu, 27 Feb 2020 18:08:18 -0800 (PST) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:500::4:d8f5]) by smtp.gmail.com with ESMTPSA id k24sm4931972pgm.61.2020.02.27.18.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:08:18 -0800 (PST) From: rentao.bupt@gmail.com To: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: [PATCH v6 7/7] dt-bindings: usb: add documentation for aspeed usb-vhub Date: Thu, 27 Feb 2020 18:07:57 -0800 Message-Id: <20200228020757.10513-8-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228020757.10513-1-rentao.bupt@gmail.com> References: <20200228020757.10513-1-rentao.bupt@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Tao Ren Add device tree binding documentation for the Aspeed USB 2.0 Virtual HUb Controller. Signed-off-by: Tao Ren Reviewed-by: Joel Stanley --- Changes in v6: - added 2 required properties into example and passed "make dt_binding_check". Changes in v5: - updated maintainer to Ben. - refined patch description per Joel's suggestion. No change in v2/v3/v4: - the patch is added to the patch series since v4. .../bindings/usb/aspeed,usb-vhub.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml diff --git a/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml new file mode 100644 index 000000000000..b9f33310e9a2 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml @@ -0,0 +1,73 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Facebook Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/aspeed,usb-vhub.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ASPEED USB 2.0 Virtual Hub Controller + +maintainers: + - Benjamin Herrenschmidt + +description: |+ + The ASPEED USB 2.0 Virtual Hub Controller implements 1 set of USB Hub + register and several sets of Device and Endpoint registers to support + the Virtual Hub's downstream USB devices. + + Supported number of devices and endpoints vary depending on hardware + revisions. AST2400 and AST2500 Virtual Hub supports 5 downstream devices + and 15 generic endpoints, while AST2600 Virtual Hub supports 7 downstream + devices and 21 generic endpoints. + +properties: + compatible: + enum: + - aspeed,ast2400-usb-vhub + - aspeed,ast2500-usb-vhub + - aspeed,ast2600-usb-vhub + + reg: + maxItems: 1 + description: Common configuration registers + + clocks: + maxItems: 1 + description: The Virtual Hub Controller clock gate + + interrupts: + maxItems: 1 + + aspeed,vhub-downstream-ports: + description: Number of downstream ports supported by the Virtual Hub + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + + aspeed,vhub-generic-endpoints: + description: Number of generic endpoints supported by the Virtual Hub + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + +required: + - compatible + - reg + - clocks + - interrupts + - aspeed,vhub-downstream-ports + - aspeed,vhub-generic-endpoints + +additionalProperties: false + +examples: + - | + #include + vhub: usb-vhub@1e6a0000 { + compatible = "aspeed,ast2500-usb-vhub"; + reg = <0x1e6a0000 0x300>; + interrupts = <5>; + clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>; + aspeed,vhub-downstream-ports = <5>; + aspeed,vhub-generic-endpoints = <15>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb2ad_default>; + };