From patchwork Tue Nov 13 19:58:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 198771 X-Patchwork-Delegate: sbabic@denx.de 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 7D6932C0089 for ; Wed, 14 Nov 2012 06:51:50 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 286554A207; Tue, 13 Nov 2012 20:51:49 +0100 (CET) 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 7qSI4zLnc3wT; Tue, 13 Nov 2012 20:51:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E4C1F4A20F; Tue, 13 Nov 2012 20:51:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 377F74A20F for ; Tue, 13 Nov 2012 20:51:44 +0100 (CET) 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 nhpNdHI8GtNk for ; Tue, 13 Nov 2012 20:51:43 +0100 (CET) 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 zose-mta12.web4all.fr (zose-mta12.web4all.fr [178.33.204.89]) by theia.denx.de (Postfix) with ESMTP id 64D084A207 for ; Tue, 13 Nov 2012 20:51:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zose-mta12.web4all.fr (Postfix) with ESMTP id 257AD904F3; Tue, 13 Nov 2012 20:55:03 +0100 (CET) X-Virus-Scanned: amavisd-new at zose1.web4all.fr Received: from zose-mta12.web4all.fr ([127.0.0.1]) by localhost (zose-mta12.web4all.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8ykzyPoBpaIn; Tue, 13 Nov 2012 20:55:02 +0100 (CET) Received: from zose-store12.web4all.fr (zose-store12.web4all.fr [178.33.204.49]) by zose-mta12.web4all.fr (Postfix) with ESMTP id 8B0F4904EF; Tue, 13 Nov 2012 20:55:02 +0100 (CET) Date: Tue, 13 Nov 2012 20:58:25 +0100 (CET) From: =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?= To: U-Boot-Users ML Message-ID: <127772676.1238971.1352836705328.JavaMail.root@advansee.com> In-Reply-To: <288431028.1238905.1352836530889.JavaMail.root@advansee.com> MIME-Version: 1.0 X-Originating-IP: [88.188.188.98] X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - FF3.0 (Win)/7.2.0_GA_2669) Cc: Marek Vasut Subject: [U-Boot] [PATCH v3 12/13] mx35pdk: Add support for OTG 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add support for the OTG port on the mx35pdk Personality board. Signed-off-by: Benoît Thébaudeau Tested-by: Stefano Babic Cc: Stefano Babic Cc: Marek Vasut --- Changes for v2: - Tested by Stefano. Changes for v3: - Fix lines over 80 characters. .../board/freescale/mx35pdk/lowlevel_init.S | 4 ++++ .../board/freescale/mx35pdk/mx35pdk.c | 21 ++++++++++++++++++++ .../include/configs/mx35pdk.h | 14 +++++++++++++ 3 files changed, 39 insertions(+) diff --git u-boot-usb-76454b2.orig/board/freescale/mx35pdk/lowlevel_init.S u-boot-usb-76454b2/board/freescale/mx35pdk/lowlevel_init.S index 698c4cf..6f4d4e0 100644 --- u-boot-usb-76454b2.orig/board/freescale/mx35pdk/lowlevel_init.S +++ u-boot-usb-76454b2/board/freescale/mx35pdk/lowlevel_init.S @@ -178,6 +178,10 @@ orr r1, r1, #0x00000C00 orr r1, r1, #0x00000003 str r1, [r0, #CLKCTL_CGR1] + + ldr r1, [r0, #CLKCTL_CGR2] + orr r1, r1, #0x00C00000 + str r1, [r0, #CLKCTL_CGR2] .endm .macro setup_sdram diff --git u-boot-usb-76454b2.orig/board/freescale/mx35pdk/mx35pdk.c u-boot-usb-76454b2/board/freescale/mx35pdk/mx35pdk.c index 7cb6b30..4fa2c27 100644 --- u-boot-usb-76454b2.orig/board/freescale/mx35pdk/mx35pdk.c +++ u-boot-usb-76454b2/board/freescale/mx35pdk/mx35pdk.c @@ -97,6 +97,26 @@ static void setup_iomux_spi(void) mxc_request_iomux(MX35_PIN_CSPI1_SCLK, MUX_CONFIG_SION); } +static void setup_iomux_usbotg(void) +{ + int in_pad, out_pad; + + /* Set up pins for USBOTG. */ + mxc_request_iomux(MX35_PIN_USBOTG_PWR, + MUX_CONFIG_SION | MUX_CONFIG_FUNC); + mxc_request_iomux(MX35_PIN_USBOTG_OC, + MUX_CONFIG_SION | MUX_CONFIG_FUNC); + + in_pad = PAD_CTL_DRV_3_3V | PAD_CTL_HYS_SCHMITZ | PAD_CTL_PKE_ENABLE | + PAD_CTL_PUE_PUD | PAD_CTL_100K_PD | PAD_CTL_ODE_CMOS | + PAD_CTL_DRV_NORMAL | PAD_CTL_SRE_SLOW; + out_pad = PAD_CTL_DRV_3_3V | PAD_CTL_HYS_CMOS | PAD_CTL_PKE_NONE | + PAD_CTL_ODE_CMOS | PAD_CTL_DRV_NORMAL | PAD_CTL_SRE_SLOW; + + mxc_iomux_set_pad(MX35_PIN_USBOTG_PWR, out_pad); + mxc_iomux_set_pad(MX35_PIN_USBOTG_OC, in_pad); +} + static void setup_iomux_fec(void) { int pad; @@ -188,6 +208,7 @@ int board_early_init_f(void) __raw_writel(readl(&ccm->rcsr) | MXC_CCM_RCSR_NFC_FMS, &ccm->rcsr); setup_iomux_i2c(); + setup_iomux_usbotg(); setup_iomux_fec(); setup_iomux_spi(); diff --git u-boot-usb-76454b2.orig/include/configs/mx35pdk.h u-boot-usb-76454b2/include/configs/mx35pdk.h index 826c912..69b7d23 100644 --- u-boot-usb-76454b2.orig/include/configs/mx35pdk.h +++ u-boot-usb-76454b2/include/configs/mx35pdk.h @@ -110,6 +110,8 @@ #define CONFIG_NET_RETRY_COUNT 100 #define CONFIG_CMD_DATE +#define CONFIG_CMD_USB +#define CONFIG_USB_STORAGE #define CONFIG_CMD_MMC #define CONFIG_DOS_PARTITION #define CONFIG_EFI_PARTITION @@ -242,6 +244,18 @@ #define CONFIG_MXC_NAND_HWECC #define CONFIG_SYS_NAND_LARGEPAGE +/* EHCI driver */ +#define CONFIG_USB_EHCI +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1 +#define CONFIG_EHCI_IS_TDI +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET +#define CONFIG_USB_EHCI_MXC +#define CONFIG_MXC_USB_PORT 0 +#define CONFIG_MXC_USB_FLAGS (MXC_EHCI_INTERFACE_DIFF_UNI | \ + MXC_EHCI_POWER_PINS_ENABLED | \ + MXC_EHCI_OC_PIN_ACTIVE_LOW) +#define CONFIG_MXC_USB_PORTSC (MXC_EHCI_UTMI_16BIT | MXC_EHCI_MODE_UTMI) + /* mmc driver */ #define CONFIG_MMC #define CONFIG_GENERIC_MMC