dm: Move s3c24xx USB driver to a proper place
[kernel/u-boot.git] / drivers / usb / host / ohci-s3c24xx.c
similarity index 97%
rename from arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
rename to drivers/usb/host/ohci-s3c24xx.c
index 944bb32..03cd4c3 100644 (file)
@@ -42,7 +42,7 @@
 #include <asm/io.h>
 #include <malloc.h>
 #include <usb.h>
-#include "usb_ohci.h"
+#include "ohci-s3c24xx.h"
 
 #define OHCI_USE_NPS           /* force NoPowerSwitching mode */
 #undef OHCI_VERBOSE_DEBUG      /* not always helpful */
@@ -1755,3 +1755,47 @@ int usb_lowlevel_stop(int index)
 }
 
 #endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_S3C24X0) */
+
+#if defined(CONFIG_USB_OHCI_NEW) && \
+    defined(CONFIG_SYS_USB_OHCI_CPU_INIT) && \
+    defined(CONFIG_S3C24X0)
+
+int usb_cpu_init(void)
+{
+       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
+       struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
+
+       /*
+        * Set the 48 MHz UPLL clocking. Values are taken from
+        * "PLL value selection guide", 6-23, s3c2400_UM.pdf.
+        */
+       writel((40 << 12) + (1 << 4) + 2, &clk_power->upllcon);
+       /* 1 = use pads related USB for USB host */
+       writel(readl(&gpio->misccr) | 0x8, &gpio->misccr);
+
+       /*
+        * Enable USB host clock.
+        */
+       writel(readl(&clk_power->clkcon) | (1 << 4), &clk_power->clkcon);
+
+       return 0;
+}
+
+int usb_cpu_stop(void)
+{
+       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
+       /* may not want to do this */
+       writel(readl(&clk_power->clkcon) & ~(1 << 4), &clk_power->clkcon);
+       return 0;
+}
+
+int usb_cpu_init_fail(void)
+{
+       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
+       writel(readl(&clk_power->clkcon) & ~(1 << 4), &clk_power->clkcon);
+       return 0;
+}
+
+#endif /* defined(CONFIG_USB_OHCI_NEW) && \
+          defined(CONFIG_SYS_USB_OHCI_CPU_INIT) && \
+          defined(CONFIG_S3C24X0) */