[PATCH 2/3] fix-kill-endpoints-before-linux.patch

Andy Green andy at openmoko.com
Fri Aug 1 08:54:18 CEST 2008


This patch ties up udc closedown before starting Linux, and
makes sure the endpoints are off in the hardware.

Signed-off-by: Andy Green <andy at openmoko.com>
---

 common/cmd_bootm.c             |    7 +++++++
 drivers/usb/usbdcore_s3c2410.c |    5 ++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8a454b8..057075a 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -60,6 +60,8 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 #include <hush.h>
 #endif
 
+extern void udc_disable (void);
+
 DECLARE_GLOBAL_DATA_PTR;
 
 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
@@ -230,6 +232,11 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	mmc_depower();
 #endif
 
+#if (defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) || \
+     defined(CONFIG_S3C2442) || defined(CONFIG_S3C2443)) && defined(CONFIG_USB_DEVICE)
+	udc_disable();
+#endif
+
 	/*
 	 * We have reached the point of no return: we are going to
 	 * overwrite all exception vector code, so we cannot easily
diff --git a/drivers/usb/usbdcore_s3c2410.c b/drivers/usb/usbdcore_s3c2410.c
index 8a982b3..a18e7e1 100644
--- a/drivers/usb/usbdcore_s3c2410.c
+++ b/drivers/usb/usbdcore_s3c2410.c
@@ -140,7 +140,10 @@ static int s3c2410_write_noniso_tx_fifo(struct usb_endpoint_instance *endpoint)
 
 static void s3c2410_deconfigure_device (void)
 {
-	/* FIXME: Implement this */
+	outl(0, S3C2410_UDC_EP1_DMA_CON);
+	outl(0, S3C2410_UDC_EP2_DMA_CON);
+	outl(0, S3C2410_UDC_EP3_DMA_CON);
+	outl(0, S3C2410_UDC_EP4_DMA_CON);
 }
 
 static void s3c2410_configure_device (struct usb_device_instance *device)





More information about the openmoko-kernel mailing list