From patchwork Thu Sep 26 01:41:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 278065 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 D0C3B2C037C for ; Thu, 26 Sep 2013 11:44:08 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F5A44A0DA; Thu, 26 Sep 2013 03:43:30 +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 aHzPXjHrYv4t; Thu, 26 Sep 2013 03:43:29 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 003964A0D3; Thu, 26 Sep 2013 03:42:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C4A5D4A0C5 for ; Thu, 26 Sep 2013 03:41:52 +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 q5nUHtjicRJN for ; Thu, 26 Sep 2013 03:41: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-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by theia.denx.de (Postfix) with ESMTPS id 706EA4A096 for ; Thu, 26 Sep 2013 03:41:14 +0200 (CEST) Received: by mail-pa0-f50.google.com with SMTP id fb1so593794pad.37 for ; Wed, 25 Sep 2013 18:41:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y86W2b/ZgtdPLns4MQZ6ICXCw9Sm833fPlqYct0f4z0=; b=RfYjssCWXo2S7b4hq3HS4dypiriLhcosldFbjTl+LSdo6lTZaD2d8B0McFC7O0FYWX 5dZ0ucpNd9odyu+M1UN5xEXfm7IuTiyqtmIoS257mlSP7rt/Tbm/szplNNhO7rj6d2Sv wUQbIZFNk5Ymb17yns1qnMZLLs0DNrVSY7GyRmj4uv+yNQSsQqb6VRzFzdPg83Ajs+Yh eGOswpUjxnoTsCcdMMueOTmvK1qetSP4+hS2iXPuawERsrgKUkeZvJOfmMSjiV9tWXcD FSFtMYO/zD+Y27tHWRZzD0GgKIsQd+BO5jizoYNLqiN/g6fHshEbJPs2YSc14dhm0fgm 44Xw== X-Gm-Message-State: ALoCoQnmIcb8Tk9oWrmD6zVdm4z+9dSmvkUNV1HQrb4HXxZZep5s9D+21xR9nCY/fotjj1NABWt+ X-Received: by 10.66.182.229 with SMTP id eh5mr2194303pac.139.1380159672778; Wed, 25 Sep 2013 18:41:12 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPSA id ia5sm50593854pbc.42.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 25 Sep 2013 18:41:11 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.80) (envelope-from ) id 1VP0a4-0006uA-Rt; Wed, 25 Sep 2013 18:41:24 -0700 From: Troy Kisky To: marek.vasut@gmail.com Date: Wed, 25 Sep 2013 18:41:17 -0700 Message-Id: <1380159678-26416-18-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380159678-26416-1-git-send-email-troy.kisky@boundarydevices.com> References: <1380159678-26416-1-git-send-email-troy.kisky@boundarydevices.com> Cc: fabio.estevam@freescale.com, otavio@ossystems.com.br, leiwen@marvell.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH V5 17/18] nitrogen6x: add otg usb host/device mode support 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 Signed-off-by: Troy Kisky --- v4: similar to Nitrogen6x: add otg usb ethernet gadget support But I added pad setup for over current, otg_id, and power control Added board_ehci_power function to enable power for host mode. Removed otg_id selection done now in previous patch. v5: changed MX6_PAD_GPIO_1__USBOTG_ID to MX6_PAD_GPIO_1__USB_OTG_ID. --- board/boundary/nitrogen6x/nitrogen6x.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index c6efafc..8523133 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -30,6 +30,7 @@ #include DECLARE_GLOBAL_DATA_PTR; +#define GP_USB_OTG_PWR IMX_GPIO_NR(3, 22) #define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ @@ -179,6 +180,14 @@ iomux_v3_cfg_t const enet_pads2[] = { MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL), }; +static iomux_v3_cfg_t const misc_pads[] = { + MX6_PAD_GPIO_1__USB_OTG_ID | MUX_PAD_CTRL(WEAK_PULLUP), + MX6_PAD_KEY_COL4__USBOH3_USBOTG_OC | MUX_PAD_CTRL(WEAK_PULLUP), + MX6_PAD_EIM_D30__USBOH3_USBH1_OC | MUX_PAD_CTRL(WEAK_PULLUP), + /* OTG Power enable */ + MX6_PAD_EIM_D22__GPIO_3_22 | MUX_PAD_CTRL(OUTPUT_40OHM), +}; + /* wl1271 pads on nitrogen6x */ iomux_v3_cfg_t const wl12xx_pads[] = { (MX6_PAD_NANDF_CS1__GPIO_6_14 & ~MUX_PAD_CTRL_MASK) @@ -250,6 +259,15 @@ int board_ehci_hcd_init(int port) return 0; } + +int board_ehci_power(int port, int on) +{ + if (port) + return 0; + gpio_set_value(GP_USB_OTG_PWR, on); + return 0; +} + #endif #ifdef CONFIG_FSL_ESDHC @@ -369,6 +387,11 @@ int board_eth_init(bd_t *bis) free(bus); } #endif + +#ifdef CONFIG_MV_UDC + /* For otg ethernet*/ + usb_eth_initialize(bis); +#endif return 0; } @@ -683,6 +706,7 @@ int board_early_init_f(void) gpio_direction_input(WL12XX_WL_IRQ_GP); gpio_direction_output(WL12XX_WL_ENABLE_GP, 0); gpio_direction_output(WL12XX_BT_ENABLE_GP, 0); + gpio_direction_output(GP_USB_OTG_PWR, 0); /* OTG power off */ imx_iomux_v3_setup_multiple_pads(wl12xx_pads, ARRAY_SIZE(wl12xx_pads)); setup_buttons(); @@ -711,6 +735,8 @@ int board_init(void) IOMUXC_GPR1_OTG_ID_MASK, IOMUXC_GPR1_OTG_ID_GPIO1); + imx_iomux_v3_setup_multiple_pads(misc_pads, ARRAY_SIZE(misc_pads)); + /* address of boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;