From patchwork Thu Aug 1 23:27:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 264162 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 294F12C0091 for ; Fri, 2 Aug 2013 09:31:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B40244A113; Fri, 2 Aug 2013 01:30:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N+3yJCxue2fp; Fri, 2 Aug 2013 01:30:38 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 395304A114; Fri, 2 Aug 2013 01:28:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 742814A0F1 for ; Fri, 2 Aug 2013 01:28:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RTVUNN6NFHzQ for ; Fri, 2 Aug 2013 01:28:29 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by theia.denx.de (Postfix) with ESMTPS id 18AFC4A054 for ; Fri, 2 Aug 2013 01:27:52 +0200 (CEST) Received: by mail-pb0-f47.google.com with SMTP id rr4so1404241pbb.34 for ; Thu, 01 Aug 2013 16:27:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=T9VD3LdP0eayB/BDdYpJRzBwq16ANO7yhIGSygTQscg=; b=Fon+mWZFPy9KdhPWt/rPEVe6DJyxsIX1xtC9ye6kdHeD1zWF7Af4bb8cYApZHBeHzQ HmYXdLGavw8hWXrBi2ccV1jSGyOZD2wjVOetzRY8NAwYilR7Jpy29t5NmTnQUW9c/leW 6EcxI43SZKX/mwMBNQgq/97dODoVJxpYb2t2wShdkCoim4Np946bomwoG9SVTQOzfJeN tzASOm6KE08bXydqtBuA5xaaZUm7asGB5o/MbuAaVnaxqQG1vskqRyibRLImUoyrqW+m ssnRA1kNCVPC2mde8kM8yKcrMxit5pDxtvLhFrpjsO7ZgRuLyiTPCAQi8VTcat8NBFHr kPXA== X-Received: by 10.66.253.40 with SMTP id zx8mr7253342pac.71.1375399670442; Thu, 01 Aug 2013 16:27:50 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPSA id kd1sm6580846pab.20.2013.08.01.16.27.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 01 Aug 2013 16:27:49 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.80) (envelope-from ) id 1V52HX-0006hC-Bs; Thu, 01 Aug 2013 16:27:43 -0700 From: Troy Kisky To: marek.vasut@gmail.com Date: Thu, 1 Aug 2013 16:27:28 -0700 Message-Id: <1375399657-25642-12-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1375399657-25642-1-git-send-email-troy.kisky@boundarydevices.com> References: <1375399657-25642-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQlKuigsGoBVjeZcraU8W7PzHDcQtHRbtl9csFj4jn8oCTPWi1lJVu0+S/sI1MNsuBbZrJSP Cc: fabio.estevam@freescale.com, otavio@ossystems.com.br, leiwen@marvell.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH V3 11/20] usb: gadget: mv_udc: split mv_udc.h file X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Move defines only needed by mv_udc.c to a file in the same directory. This allows usbtty to compile for mv_udc, but it still doesn't link. Signed-off-by: Troy Kisky --- drivers/usb/gadget/mv_udc.c | 6 +++ drivers/usb/gadget/mv_udc.h | 115 ++++++++++++++++++++++++++++++++++++++++++ include/usb/mv_udc.h | 118 -------------------------------------------- 3 files changed, 121 insertions(+), 118 deletions(-) create mode 100644 drivers/usb/gadget/mv_udc.h diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c index 26f193d..0ff2e5e 100644 --- a/drivers/usb/gadget/mv_udc.c +++ b/drivers/usb/gadget/mv_udc.c @@ -14,9 +14,15 @@ #include #include #include +#include #include +#include #include +#include +#include #include +#include "../host/ehci.h" +#include "mv_udc.h" #if CONFIG_USB_MAX_CONTROLLER_COUNT > 1 #error This driver only supports one single controller. diff --git a/drivers/usb/gadget/mv_udc.h b/drivers/usb/gadget/mv_udc.h new file mode 100644 index 0000000..c7d8b33 --- /dev/null +++ b/drivers/usb/gadget/mv_udc.h @@ -0,0 +1,115 @@ +/* + * Copyright 2011, Marvell Semiconductor Inc. + * + * Licensed under the GPL-2 or later. + */ +#ifndef __GADGET__MV_UDC_H__ +#define __GADGET__MV_UDC_H__ + +#define NUM_ENDPOINTS 6 + +struct mv_udc { +#define MICRO_8FRAME 0x8 +#define USBCMD_ITC(x) ((((x) > 0xff) ? 0xff : x) << 16) +#define USBCMD_FS2 (1 << 15) +#define USBCMD_RST (1 << 1) +#define USBCMD_RUN (1) + u32 usbcmd; /* 0x140 */ +#define STS_SLI (1 << 8) +#define STS_URI (1 << 6) +#define STS_PCI (1 << 2) +#define STS_UEI (1 << 1) +#define STS_UI (1 << 0) + u32 usbsts; /* 0x144 */ + u32 pad1[3]; + u32 devaddr; /* 0x154 */ + u32 epinitaddr; /* 0x158 */ + u32 pad2[10]; +#define PTS_ENABLE 2 +#define PTS(x) (((x) & 0x3) << 30) +#define PFSC (1 << 24) + u32 portsc; /* 0x184 */ + u32 pad3[8]; +#define USBMODE_DEVICE 2 + u32 usbmode; /* 0x1a8 */ + u32 epstat; /* 0x1ac */ +#define EPT_TX(x) (1 << (((x) & 0xffff) + 16)) +#define EPT_RX(x) (1 << ((x) & 0xffff)) + u32 epprime; /* 0x1b0 */ + u32 epflush; /* 0x1b4 */ + u32 pad4; + u32 epcomp; /* 0x1bc */ +#define CTRL_TXE (1 << 23) +#define CTRL_TXR (1 << 22) +#define CTRL_RXE (1 << 7) +#define CTRL_RXR (1 << 6) +#define CTRL_TXT_BULK (2 << 18) +#define CTRL_RXT_BULK (2 << 2) + u32 epctrl[16]; /* 0x1c0 */ +}; + +struct mv_ep { + struct usb_ep ep; + struct list_head queue; + const struct usb_endpoint_descriptor *desc; + + struct usb_request req; + uint8_t *b_buf; + uint32_t b_len; + uint8_t b_fast[64] __aligned(ARCH_DMA_MINALIGN); +}; + +struct mv_drv { + struct usb_gadget gadget; + struct usb_gadget_driver *driver; + struct ehci_ctrl *ctrl; + struct ept_queue_head *epts; + struct ept_queue_item *items[2 * NUM_ENDPOINTS]; + uint8_t *items_mem; + struct mv_ep ep[NUM_ENDPOINTS]; +}; + +struct ept_queue_head { + unsigned config; + unsigned current; /* read-only */ + + unsigned next; + unsigned info; + unsigned page0; + unsigned page1; + unsigned page2; + unsigned page3; + unsigned page4; + unsigned reserved_0; + + unsigned char setup_data[8]; + + unsigned reserved_1; + unsigned reserved_2; + unsigned reserved_3; + unsigned reserved_4; +}; + +#define CONFIG_MAX_PKT(n) ((n) << 16) +#define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */ +#define CONFIG_IOS (1 << 15) /* IRQ on setup */ + +struct ept_queue_item { + unsigned next; + unsigned info; + unsigned page0; + unsigned page1; + unsigned page2; + unsigned page3; + unsigned page4; + unsigned reserved; +}; + +#define TERMINATE 1 +#define INFO_BYTES(n) ((n) << 16) +#define INFO_IOC (1 << 15) +#define INFO_ACTIVE (1 << 7) +#define INFO_HALTED (1 << 6) +#define INFO_BUFFER_ERROR (1 << 5) +#define INFO_TX_ERROR (1 << 3) +#endif diff --git a/include/usb/mv_udc.h b/include/usb/mv_udc.h index c71516c..f6c7b5e 100644 --- a/include/usb/mv_udc.h +++ b/include/usb/mv_udc.h @@ -9,124 +9,6 @@ #ifndef __MV_UDC_H__ #define __MV_UDC_H__ -#include -#include -#include -#include - -#include "../../drivers/usb/host/ehci.h" - -#define NUM_ENDPOINTS 6 - -/* Endpoint parameters */ -#define MAX_ENDPOINTS 4 - #define EP_MAX_PACKET_SIZE 0x200 #define EP0_MAX_PACKET_SIZE 64 - -struct mv_udc { -#define MICRO_8FRAME 0x8 -#define USBCMD_ITC(x) ((((x) > 0xff) ? 0xff : x) << 16) -#define USBCMD_FS2 (1 << 15) -#define USBCMD_RST (1 << 1) -#define USBCMD_RUN (1) - u32 usbcmd; /* 0x140 */ -#define STS_SLI (1 << 8) -#define STS_URI (1 << 6) -#define STS_PCI (1 << 2) -#define STS_UEI (1 << 1) -#define STS_UI (1 << 0) - u32 usbsts; /* 0x144 */ - u32 pad1[3]; - u32 devaddr; /* 0x154 */ - u32 epinitaddr; /* 0x158 */ - u32 pad2[10]; -#define PTS_ENABLE 2 -#define PTS(x) (((x) & 0x3) << 30) -#define PFSC (1 << 24) - u32 portsc; /* 0x184 */ - u32 pad3[8]; -#define USBMODE_DEVICE 2 - u32 usbmode; /* 0x1a8 */ - u32 epstat; /* 0x1ac */ -#define EPT_TX(x) (1 << (((x) & 0xffff) + 16)) -#define EPT_RX(x) (1 << ((x) & 0xffff)) - u32 epprime; /* 0x1b0 */ - u32 epflush; /* 0x1b4 */ - u32 pad4; - u32 epcomp; /* 0x1bc */ -#define CTRL_TXE (1 << 23) -#define CTRL_TXR (1 << 22) -#define CTRL_RXE (1 << 7) -#define CTRL_RXR (1 << 6) -#define CTRL_TXT_BULK (2 << 18) -#define CTRL_RXT_BULK (2 << 2) - u32 epctrl[16]; /* 0x1c0 */ -}; - -struct mv_ep { - struct usb_ep ep; - struct list_head queue; - const struct usb_endpoint_descriptor *desc; - - struct usb_request req; - uint8_t *b_buf; - uint32_t b_len; - uint8_t b_fast[64] __aligned(ARCH_DMA_MINALIGN); -}; - -struct mv_drv { - struct usb_gadget gadget; - struct usb_gadget_driver *driver; - struct ehci_ctrl *ctrl; - struct ept_queue_head *epts; - struct ept_queue_item *items[2 * NUM_ENDPOINTS]; - uint8_t *items_mem; - struct mv_ep ep[NUM_ENDPOINTS]; -}; - -struct ept_queue_head { - unsigned config; - unsigned current; /* read-only */ - - unsigned next; - unsigned info; - unsigned page0; - unsigned page1; - unsigned page2; - unsigned page3; - unsigned page4; - unsigned reserved_0; - - unsigned char setup_data[8]; - - unsigned reserved_1; - unsigned reserved_2; - unsigned reserved_3; - unsigned reserved_4; -}; - -#define CONFIG_MAX_PKT(n) ((n) << 16) -#define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */ -#define CONFIG_IOS (1 << 15) /* IRQ on setup */ - -struct ept_queue_item { - unsigned next; - unsigned info; - unsigned page0; - unsigned page1; - unsigned page2; - unsigned page3; - unsigned page4; - unsigned reserved; -}; - -#define TERMINATE 1 -#define INFO_BYTES(n) ((n) << 16) -#define INFO_IOC (1 << 15) -#define INFO_ACTIVE (1 << 7) -#define INFO_HALTED (1 << 6) -#define INFO_BUFFER_ERROR (1 << 5) -#define INFO_TX_ERROR (1 << 3) - #endif /* __MV_UDC_H__ */