[U-Boot] [SPEAr Fixes PATCH 10/11] spear: Enable ehci support

Vipin Kumar vipin.kumar at st.com
Fri Nov 2 18:39:53 CET 2012


Signed-off-by: Vipin Kumar <vipin.kumar at st.com>
---
 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 at 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 <common.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/misc.h>
+
+#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 at 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 <common.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/misc.h>
+
+#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 <usb.h>
 #include "ehci.h"
 #include <asm/arch/hardware.h>
-
+#include <asm/arch/generic.h>
 
 /*
  * 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;
 }
-- 
1.7.11.4



More information about the U-Boot mailing list