From patchwork Fri Nov 2 17:39:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Kumar X-Patchwork-Id: 196715 X-Patchwork-Delegate: vipin.kumar@st.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 388092C00D7 for ; Sat, 3 Nov 2012 05:18:09 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 672CA4AEC6; Fri, 2 Nov 2012 19:18:02 +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 Gb9JosamFE5j; Fri, 2 Nov 2012 19:18:02 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 702C44AEE0; Fri, 2 Nov 2012 19:16:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7682B4AECF for ; Fri, 2 Nov 2012 19:16:48 +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 5I1kHe7cctld for ; Fri, 2 Nov 2012 19:16:46 +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 eu1sys200aog114.obsmtp.com (eu1sys200aog114.obsmtp.com [207.126.144.137]) by theia.denx.de (Postfix) with ESMTPS id C2CC74AEC1 for ; Fri, 2 Nov 2012 19:16:41 +0100 (CET) Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob114.postini.com ([207.126.147.11]) with SMTP ID DSNKUJQOCOZJnxjDLQvxRhCbPyXOdm7VoHCb@postini.com; Fri, 02 Nov 2012 18:16:44 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 40C5018D; Fri, 2 Nov 2012 17:36:12 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas2.st.com [10.80.176.10]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 6E28C107D; Fri, 2 Nov 2012 17:44:25 +0000 (GMT) Received: from localhost (10.251.136.62) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.245.1; Sat, 3 Nov 2012 01:44:24 +0800 From: Vipin Kumar To: Date: Fri, 2 Nov 2012 23:09:53 +0530 Message-ID: X-Mailer: git-send-email 1.7.10.rc2.10.gb47606 In-Reply-To: References: MIME-Version: 1.0 Cc: sr@denx.de, spear-devel@list.st.com Subject: [U-Boot] [SPEAr Fixes PATCH 10/11] spear: Enable ehci 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Vipin Kumar --- arch/arm/cpu/arm926ejs/spear/Makefile | 2 ++ arch/arm/cpu/arm926ejs/spear/cpu.c | 3 +++ arch/arm/cpu/arm926ejs/spear/spear3xx.c | 43 +++++++++++++++++++++++++++++++ arch/arm/cpu/arm926ejs/spear/spear6xx.c | 43 +++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-spear/generic.h | 3 +++ drivers/usb/host/ehci-spear.c | 9 ++++++- 6 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 arch/arm/cpu/arm926ejs/spear/spear3xx.c create mode 100644 arch/arm/cpu/arm926ejs/spear/spear6xx.c diff --git a/arch/arm/cpu/arm926ejs/spear/Makefile b/arch/arm/cpu/arm926ejs/spear/Makefile index 3fe7e26..7d11035 100644 --- a/arch/arm/cpu/arm926ejs/spear/Makefile +++ b/arch/arm/cpu/arm926ejs/spear/Makefile @@ -30,6 +30,8 @@ COBJS-y := cpu.o \ timer.o COBJS-$(CONFIG_ST_EMI) += emi.o +COBJS-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o +COBJS-$(CONFIG_ARCH_SPEAR6XX) += spear6xx.o ifdef CONFIG_SPL_BUILD COBJS-y += spl.o spl_boot.o diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c b/arch/arm/cpu/arm926ejs/spear/cpu.c index d7608b2..59655f5 100644 --- a/arch/arm/cpu/arm926ejs/spear/cpu.c +++ b/arch/arm/cpu/arm926ejs/spear/cpu.c @@ -88,6 +88,9 @@ int arch_cpu_init(void) #if defined(CONFIG_NAND_FSMC) periph1_clken |= MISC_FSMCENB; #endif +#if defined(CONFIG_USB_EHCI_SPEAR) + periph1_clken |= MISC_USBHENB; +#endif writel(periph1_clken, &misc_p->periph1_clken); diff --git a/arch/arm/cpu/arm926ejs/spear/spear3xx.c b/arch/arm/cpu/arm926ejs/spear/spear3xx.c new file mode 100644 index 0000000..7a85fa9 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/spear/spear3xx.c @@ -0,0 +1,43 @@ +/* + * (C) Copyright 2012 + * Vipin Kumar, ST Microelectronics, vipin.kumar@st.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#if defined(CONFIG_USB_EHCI_SPEAR) +void spear3xx_usbh_stop(void) +{ + struct misc_regs *const misc_p = + (struct misc_regs *)CONFIG_SPEAR_MISCBASE; + u32 periph1_rst = readl(misc_p->periph1_rst); + + periph1_rst |= MISC_USBHENB; + writel(periph1_rst, misc_p->periph1_rst); + + udelay(1000); + periph1_rst &= ~MISC_USBHENB; + writel(periph1_rst, misc_p->periph1_rst); +} +#endif diff --git a/arch/arm/cpu/arm926ejs/spear/spear6xx.c b/arch/arm/cpu/arm926ejs/spear/spear6xx.c new file mode 100644 index 0000000..0a798ec --- /dev/null +++ b/arch/arm/cpu/arm926ejs/spear/spear6xx.c @@ -0,0 +1,43 @@ +/* + * (C) Copyright 2012 + * Vipin Kumar, ST Microelectronics, vipin.kumar@st.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#if defined(CONFIG_USB_EHCI_SPEAR) +void spear6xx_usbh_stop(void) +{ + struct misc_regs *const misc_p = + (struct misc_regs *)CONFIG_SPEAR_MISCBASE; + u32 periph1_rst = readl(misc_p->periph1_rst); + + periph1_rst |= MISC_USBHENB; + writel(periph1_rst, misc_p->periph1_rst); + + udelay(1000); + periph1_rst &= ~MISC_USBHENB; + writel(periph1_rst, misc_p->periph1_rst); +} +#endif diff --git a/arch/arm/include/asm/arch-spear/generic.h b/arch/arm/include/asm/arch-spear/generic.h index 68a775e..b7026e2 100644 --- a/arch/arm/include/asm/arch-spear/generic.h +++ b/arch/arm/include/asm/arch-spear/generic.h @@ -30,6 +30,9 @@ extern unsigned int setfreq_sz; extern void board_ddr_init(void); extern void board_lowlevel_late_init(void); +extern void spear3xx_usbh_stop(void); +extern void spear6xx_usbh_stop(void); + extern u32 mpmc_conf_vals[]; /* diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index f99bd1f..71c4ea2 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -30,7 +30,7 @@ #include #include "ehci.h" #include - +#include /* * Create the appropriate control structures to manage @@ -55,5 +55,12 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) */ int ehci_hcd_stop(int index) { +#if defined(CONFIG_ARCH_SPEAR3XX) + spear3xx_usbh_stop(); +#elif defined(CONFIG_ARCH_SPEAR6XX) + spear6xx_usbh_stop(); +#else +#error No spear platforms defined +#endif return 0; }