From d00220acd5eb15fcc35e91b11f1a051db30b77af Mon Sep 17 00:00:00 2001
From: z3deverp <z3@vmsv-debian.(none)>
Date: Tue, 8 Jul 2008 07:51:15 +0900
Subject: [PATCH] little changes: USB host, W-SIM

---
 arch/arm/mach-pxa/sha_pon.c |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/sha_pon.c b/arch/arm/mach-pxa/sha_pon.c
old mode 100644
new mode 100755
index 88a5ff7..c24c8fb
--- a/arch/arm/mach-pxa/sha_pon.c
+++ b/arch/arm/mach-pxa/sha_pon.c
@@ -199,6 +199,8 @@ static struct platform_device sha_pon011ts_device = {
 /* W-SIM */
 static void sha_pon_reset_wsim(void)
 {
+#if 0		/* FIXME: LCD is blank on only 003,004...why? */
+
 	/* Power-ON-reset W-SIM device as a modem connected to FFUART */
 	/* power down */
 	SHA_PON_CPLD10 = 0x00;
@@ -206,6 +208,8 @@ static void sha_pon_reset_wsim(void)
 	mdelay(800*4);		/* tested value=800msec(min) --> margine factor=4 */
 	/* power up */
 	SHA_PON_CPLD10 = 0x10;
+
+#endif
 }
 
 
@@ -236,21 +240,47 @@ static int sha_pon_usb_init(struct device *dev)
 {
 	/* enable USB port2, Differencial, Host mode, D+/D- Pulldown */
 	UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
+	
+	/* enable power for USB port2 */
+	UHCHR &= ~(UHCHR_SSEP2 | UHCHR_SSE);
+	
+	/* TEST: enable power for USB port1 */
+	/* must be disabled if detect over curent at port 1 */
+	UHCHR &= ~(UHCHR_SSEP1);
+	
 	return(0);
 }
 
 static void sha_pon_usb_exit(struct device *dev)
 {
+	/* TEST: disable power for USB port1 */
+	UHCHR |= (UHCHR_SSEP1);
+
+	/* disable power for USB port2 */
+	UHCHR |= (UHCHR_SSEP2 | UHCHR_SSE);
+	
 	/* disable USB port2 */
 	UP2OCR = 0;
+
 }
 
 
+static struct pxaohci_platform_data sha_pon003_usb_info = {
+	.init		= sha_pon_usb_init,
+	.exit		= sha_pon_usb_exit,
+	.port_mode	= PMM_NPS_MODE,		/* FIXME: Non-power switching mode */
+	/* WS003SH/WS004SH: VBUS is for only internal device. */
+	.power_budget	= 0,			/* VBUS power supply per port(unit:mA) */
+};
+
+
 static struct pxaohci_platform_data sha_pon_usb_info = {
 	.init		= sha_pon_usb_init,
 	.exit		= sha_pon_usb_exit,
 	.port_mode	= PMM_NPS_MODE,		/* FIXME: Non-power switching mode */
-	.power_budget	= 0,			/* FIXME: ??? */
+	/* WS007SH/WS011SH: VBUS power supply is max100mA. */
+	/* Reference from Sharp's web support page. */
+	.power_budget	= 100,			/* VBUS power supply per port(unit:mA) */
 };
 
 
@@ -286,7 +316,7 @@ static void __init sha_pon003_init(void)
 #if UDC
 	pxa_set_udc_info(&sha_pon_udc_info);
 #endif
-	pxa_set_ohci_info(&sha_pon_usb_info);
+	pxa_set_ohci_info(&sha_pon003_usb_info);
 #if TS
 	sha_pon_ssp_set_machinfo(&sha_pon003ssp_machinfo);
 #endif
-- 
1.4.4.4

