Selaa lähdekoodia

[ARM] 4174/1: H1940 usb device definitions

This patch is adding the usb device controller to the h1940 device
list. It's also adding the code to handle the usb pull-ups.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Arnaud Patard 18 vuotta sitten
vanhempi
commit
71a9c42412
1 muutettua tiedostoa jossa 47 lisäystä ja 1 poistoa
  1. 47 1
      arch/arm/mach-s3c2410/mach-h1940.c

+ 47 - 1
arch/arm/mach-s3c2410/mach-h1940.c

@@ -33,10 +33,13 @@
 
 
 #include <asm/arch/regs-serial.h>
 #include <asm/arch/regs-serial.h>
 #include <asm/arch/regs-lcd.h>
 #include <asm/arch/regs-lcd.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/regs-clock.h>
 
 
 #include <asm/arch/h1940.h>
 #include <asm/arch/h1940.h>
 #include <asm/arch/h1940-latch.h>
 #include <asm/arch/h1940-latch.h>
 #include <asm/arch/fb.h>
 #include <asm/arch/fb.h>
+#include <asm/arch/udc.h>
 
 
 #include <asm/plat-s3c24xx/clock.h>
 #include <asm/plat-s3c24xx/clock.h>
 #include <asm/plat-s3c24xx/devs.h>
 #include <asm/plat-s3c24xx/devs.h>
@@ -102,6 +105,32 @@ void h1940_latch_control(unsigned int clear, unsigned int set)
 
 
 EXPORT_SYMBOL_GPL(h1940_latch_control);
 EXPORT_SYMBOL_GPL(h1940_latch_control);
 
 
+static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
+{
+	printk(KERN_DEBUG "udc: pullup(%d)\n",cmd);
+
+	switch (cmd)
+	{
+		case S3C2410_UDC_P_ENABLE :
+			h1940_latch_control(0, H1940_LATCH_USB_DP);
+			break;
+		case S3C2410_UDC_P_DISABLE :
+			h1940_latch_control(H1940_LATCH_USB_DP, 0);
+			break;
+		case S3C2410_UDC_P_RESET :
+			break;
+		default:
+			break;
+	}
+}
+
+static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
+	.udc_command		= h1940_udc_pullup,
+	.vbus_pin		= S3C2410_GPG5,
+	.vbus_pin_inverted	= 1,
+};
+
+
 
 
 /**
 /**
  * Set lcd on or off
  * Set lcd on or off
@@ -152,6 +181,7 @@ static struct platform_device *h1940_devices[] __initdata = {
 	&s3c_device_wdt,
 	&s3c_device_wdt,
 	&s3c_device_i2c,
 	&s3c_device_i2c,
 	&s3c_device_iis,
 	&s3c_device_iis,
+	&s3c_device_usbgadget,
 };
 };
 
 
 static struct s3c24xx_board h1940_board __initdata = {
 static struct s3c24xx_board h1940_board __initdata = {
@@ -179,7 +209,23 @@ static void __init h1940_init_irq(void)
 
 
 static void __init h1940_init(void)
 static void __init h1940_init(void)
 {
 {
+	u32 tmp;
+
 	s3c24xx_fb_set_platdata(&h1940_lcdcfg);
 	s3c24xx_fb_set_platdata(&h1940_lcdcfg);
+ 	s3c24xx_udc_set_platdata(&h1940_udc_cfg);
+
+	/* Turn off suspend on both USB ports, and switch the
+	 * selectable USB port to USB device mode. */
+
+	s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+			      S3C2410_MISCCR_USBSUSPND0 |
+			      S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+	tmp = (
+		 0x78 << S3C2410_PLLCON_MDIVSHIFT)
+	      | (0x02 << S3C2410_PLLCON_PDIVSHIFT)
+	      | (0x03 << S3C2410_PLLCON_SDIVSHIFT);
+	writel(tmp, S3C2410_UPLLCON);
 }
 }
 
 
 MACHINE_START(H1940, "IPAQ-H1940")
 MACHINE_START(H1940, "IPAQ-H1940")
@@ -189,6 +235,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
 	.boot_params	= S3C2410_SDRAM_PA + 0x100,
 	.boot_params	= S3C2410_SDRAM_PA + 0x100,
 	.map_io		= h1940_map_io,
 	.map_io		= h1940_map_io,
 	.init_irq	= h1940_init_irq,
 	.init_irq	= h1940_init_irq,
-	.init_machine   = h1940_init,
+	.init_machine	= h1940_init,
 	.timer		= &s3c24xx_timer,
 	.timer		= &s3c24xx_timer,
 MACHINE_END
 MACHINE_END