From patchwork Thu Aug 1 23:27:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 264169 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 DFA342C0084 for ; Fri, 2 Aug 2013 09:32:25 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 13B494A175; Fri, 2 Aug 2013 01:31:40 +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 hj8R+IMxrX-K; Fri, 2 Aug 2013 01:31:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4B964A14A; Fri, 2 Aug 2013 01:29:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B7D194A11B for ; Fri, 2 Aug 2013 01:28:51 +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 dS4rEnnAGjUy for ; Fri, 2 Aug 2013 01:28:46 +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-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by theia.denx.de (Postfix) with ESMTPS id 037984A03B for ; Fri, 2 Aug 2013 01:27:55 +0200 (CEST) Received: by mail-pa0-f48.google.com with SMTP id kp13so2675802pab.21 for ; Thu, 01 Aug 2013 16:27:54 -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=BcMhCYdxJxtTDbPaQjcgv8mPCBBH1itzi+jMs6j87hA=; b=kHakaHQ/fqo7/K1Otwa4xIcNlOxgSkD9v7DdzB0McIDXG3sCCYmgst9vQf+Qfcd+gw NTPnqqCHxR6FRtIZ6iK1FzGo9Z5OhTcoSc5mnLL9Q1jysdBj3TAk6XV3RrBSZfDb8ps5 +CpSPRtVEhFCK1ZRcdmjUTbVokbzVbTMgGGPKBJPZ2Yg7xGkvPtl8CkExrha5Nx3qnQN U6AEL8V7DPs7PgPLaqPdvdw5hj8IBK891UuNFGqsdUPjFlsuwikjmks8jUEiHSp54Roc yC0kxwGnSvpG0jhb9DfZlgOGe/exKtiBhtRPZKiX2HmhQCxaZ2fI8khQdRCKv8y1DMST hyBA== X-Received: by 10.66.76.34 with SMTP id h2mr7028314paw.128.1375399674308; Thu, 01 Aug 2013 16:27:54 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPSA id y6sm6405829pbl.23.2013.08.01.16.27.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 01 Aug 2013 16:27:53 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.80) (envelope-from ) id 1V52HW-0006gs-Qg; Thu, 01 Aug 2013 16:27:42 -0700 From: Troy Kisky To: marek.vasut@gmail.com Date: Thu, 1 Aug 2013 16:27:23 -0700 Message-Id: <1375399657-25642-7-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: ALoCoQmX1JsdYIJ5dMrR1uqpSusMlKbzugrJmNs3uM+dZLHf78CvO1v88l768Vh7/6AgHbs2LXci Cc: fabio.estevam@freescale.com, otavio@ossystems.com.br, leiwen@marvell.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH V3 06/20] usb: gadget: mv_udc: fix hardware udc address for i.MX6 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 The hcor for i.MX6 is 02184340 and the udc should be 02184140 Signed-off-by: Troy Kisky --- I don't know if this is a correct fix, please check carefully. --- drivers/usb/gadget/mv_udc.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c index 7574e31..359b8e1 100644 --- a/drivers/usb/gadget/mv_udc.c +++ b/drivers/usb/gadget/mv_udc.c @@ -110,6 +110,16 @@ static struct mv_drv controller = { }, }; +struct mv_udc *get_mv_udc(void) +{ +#ifdef CONFIG_MXC_USB_PORT + return (struct mv_udc *)((unsigned)controller.ctrl->hcor + - (0x200 * CONFIG_MXC_USB_PORT)); +#else + return (struct mv_udc *)controller.ctrl->hcor; +#endif +} + /** * mv_get_qh() - return queue head for endpoint * @ep_num: Endpoint number @@ -213,7 +223,7 @@ static void mv_ep_free_request(struct usb_ep *ep, struct usb_request *_req) static void ep_enable(int num, int in) { struct ept_queue_head *head; - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); unsigned n; head = mv_get_qh(num, in); @@ -316,7 +326,7 @@ static int mv_ep_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) { struct mv_ep *mv_ep = container_of(ep, struct mv_ep, ep); - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); struct ept_queue_item *item; struct ept_queue_head *head; int bit, num, len, in, ret; @@ -389,7 +399,7 @@ static void handle_ep_complete(struct mv_ep *ep) static void handle_setup(void) { struct usb_request *req = &controller.ep[0].req; - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); struct ept_queue_head *head; struct usb_ctrlrequest r; int status = 0; @@ -462,7 +472,7 @@ static void stop_activity(void) { int i, num, in; struct ept_queue_head *head; - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); writel(readl(&udc->epcomp), &udc->epcomp); writel(readl(&udc->epstat), &udc->epstat); writel(0xffffffff, &udc->epflush); @@ -485,7 +495,7 @@ static void stop_activity(void) void udc_irq(void) { - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); unsigned n = readl(&udc->usbsts); writel(n, &udc->usbsts); int bit, i, num, in; @@ -543,7 +553,7 @@ void udc_irq(void) int usb_gadget_handle_interrupts(void) { u32 value; - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); value = readl(&udc->usbsts); if (value) @@ -554,7 +564,7 @@ int usb_gadget_handle_interrupts(void) static int mv_pullup(struct usb_gadget *gadget, int is_on) { - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); if (is_on) { /* RESET */ writel(USBCMD_ITC(MICRO_8FRAME) | USBCMD_RST, &udc->usbcmd); @@ -582,7 +592,7 @@ static int mv_pullup(struct usb_gadget *gadget, int is_on) void udc_disconnect(void) { - struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor; + struct mv_udc *udc = get_mv_udc(); /* disable pullup */ stop_activity(); writel(USBCMD_FS2, &udc->usbcmd); @@ -694,7 +704,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ret = mvudc_probe(); if (!ret) { - udc = (struct mv_udc *)controller.ctrl->hcor; + udc = get_mv_udc(); /* select ULPI phy */ writel(PTS(PTS_ENABLE) | PFSC, &udc->portsc);