rk2928_defconfig: host_drv gpio control
authorkfx <kfx@rock-chips.com>
Wed, 31 Oct 2012 01:30:22 +0000 (09:30 +0800)
committerkfx <kfx@rock-chips.com>
Wed, 31 Oct 2012 01:30:22 +0000 (09:30 +0800)
arch/arm/mach-rk2928/board-rk2928-config.c
arch/arm/mach-rk2928/include/mach/config.h
drivers/usb/dwc_otg/usbdev_rk2928.c

index e3f690d567fbb3470bd7a31b2fc485080bd46754..b16d609a8514af06b09f00027aa436ea79b32f21 100644 (file)
@@ -74,7 +74,39 @@ static inline int check_bl_param(void)
         }
         return 0;
 }
-
+/* usb */
+static int otg_drv = DEF_OTG_DRV;
+module_param(otg_drv, int, 0644);
+static int host_drv = DEF_HOST_DRV;
+module_param(host_drv, int, 0644);
+static inline int check_usb_param(void)
+{
+        return 0;
+}
+int inline otg_drv_init(int on)
+{
+        return port_output_init(otg_drv, on, "otg_drv");
+}
+void inline otg_drv_on(void)
+{
+        port_output_on(otg_drv);
+}
+void inline otg_drv_off(void)
+{
+        port_output_off(otg_drv);
+}
+int inline host_drv_init(int on)
+{
+        return port_output_init(host_drv, on, "host_drv");
+}
+void inline host_drv_on(void)
+{
+        port_output_on(host_drv);
+}
+void inline host_drv_off(void)
+{
+        port_output_off(host_drv);
+}
 /* lcd */
 static int lcd_cabc = DEF_LCD_CABC;
 module_param(lcd_cabc, int, 0644);
index f79a53c0cc419aed14c6f243966f617c8471f00c..cc698dfa93ea3bd92d9ff5e4b5c4aa09f271c6c7 100644 (file)
@@ -41,12 +41,12 @@ enum {
 enum{
         DEF_KEY_ADC = 1,
         DEF_PLAY_KEY = 0x000101a4,
-        DEF_VOLDN_KEY = 0x000102b4,
+        DEF_VOLDN_KEY = 0x000102b6,
         DEF_VOLUP_KEY = 1  | (1<<31),
-        DEF_MENU_KEY = 135 | (1<<31),
-        DEF_ESC_KEY = 334  | (1<<31),
-        DEF_HOME_KEY = 550 | (1<<31),
-        DEF_CAM_KEY = 700  | (1<<31),
+        DEF_MENU_KEY = 100 | (1<<31),
+        DEF_ESC_KEY = 255  | (1<<31),
+        DEF_HOME_KEY = 425 | (1<<31),
+        DEF_CAM_KEY = 576  | (1<<31),
 };
 /* backlight */
 enum{
@@ -55,6 +55,11 @@ enum{
         DEF_BL_MIN = 60,
         DEF_BL_EN = 0x000002c1,
 };
+/* usb */
+enum {
+        DEF_OTG_DRV = -1,
+        DEF_HOST_DRV = 0x000002b4,
+};
 /* lcd */
 enum {
         DEF_LCD_CABC = 0x000002c3,
@@ -165,6 +170,11 @@ enum{
         DEF_BL_MIN = 60,
         DEF_BL_EN = 0x000003c4,
 };
+/* usb */
+enum {
+        DEF_OTG_DRV = -1,
+        DEF_HOST_DRV = 0x000001b2,
+};
 /* lcd */
 enum {
         DEF_LCD_CABC = 0x000002d1,
@@ -277,6 +287,12 @@ enum{
         DEF_BL_MIN = 80,
         DEF_BL_EN = -1,
 };
+
+/* usb */
+enum {
+        DEF_OTG_DRV = -1,
+        DEF_HOST_DRV = -1,
+};
 /* lcd */
 enum {
         DEF_LCD_CABC = -1,
@@ -388,6 +404,11 @@ enum{
         DEF_BL_MIN = 80,
         DEF_BL_EN = 0x000003c5,
 };
+/* usb */
+enum {
+        DEF_OTG_DRV = -1,
+        DEF_HOST_DRV = -1,
+};
 /* lcd */
 enum {
         DEF_LCD_CABC = -1,
@@ -499,6 +520,11 @@ enum{
         DEF_BL_MIN = 80,
         DEF_BL_EN = 0x000001b0,
 };
+/* usb */
+enum {
+        DEF_OTG_DRV = -1,
+        DEF_HOST_DRV = -1,
+};
 /* lcd */
 enum {
         DEF_LCD_CABC = -1,
@@ -612,6 +638,11 @@ enum{
         DEF_BL_MIN = 0,
         DEF_BL_EN = -1,
 };
+/* usb */
+enum {
+        DEF_OTG_DRV = -1,
+        DEF_HOST_DRV = -1,
+};
 /* lcd */
 enum {
         DEF_LCD_CABC = -1,
@@ -703,7 +734,14 @@ enum {
 enum {
         DEF_PWR_ON = -1,
 };
-
 #endif
 
+int inline otg_drv_init(int on);
+void inline otg_drv_on(void);
+void inline otg_drv_off(void);
+
+int inline host_drv_init(int on);
+void inline host_drv_on(void);
+void inline host_drv_off(void);
+
 #endif
index 2885e166b666b7cc11b881d2bd9a6f5fba913abb..51c8aec42760eda55c3c830b60cf0d3b1a6bc568 100755 (executable)
@@ -8,6 +8,7 @@
 #include <mach/gpio.h>\r
 #include <mach/iomux.h>\r
 #include <mach/cru.h>\r
+#include <mach/config.h>\r
 \r
 #include "usbdev_rk.h"\r
 #include "dwc_otg_regs.h"\r
@@ -98,7 +99,11 @@ void usb20otg_hw_init(void)
     *(unsigned int *)(USBGRF_UOC0_CON0) = 0x07e70350;\r
 \r
     // other hardware init\r
+#ifdef CONFIG_RK_CONFIG\r
+    otg_drv_init(0);\r
+#else\r
     rk30_mux_api_set(GPIO3C1_OTG_DRVVBUS_NAME, GPIO3C_OTG_DRVVBUS);    \r
+#endif\r
 }\r
 void usb20otg_phy_suspend(void* pdata, int suspend)\r
 {\r
@@ -199,6 +204,12 @@ void dwc_otg_uart_mode(void* pdata, int enter_usb_uart_mode)
 \r
 void usb20otg_power_enable(int enable)\r
 {\r
+#ifdef CONFIG_RK_CONFIG\r
+        if(enable)\r
+                otg_drv_on();\r
+        else\r
+                otg_drv_off();\r
+#endif\r
 }\r
 struct dwc_otg_platform_data usb20otg_pdata = {\r
     .phyclk = NULL,\r
@@ -244,7 +255,9 @@ void usb20host_hw_init(void)
     // usb phy config init\r
     *(unsigned int *)(USBGRF_UOC1_CON0) = 0x07e70350;\r
     // other haredware init\r
-    \r
+#ifdef CONFIG_RK_CONFIG\r
+    host_drv_init(1);\r
+#endif\r
 }\r
 void usb20host_phy_suspend(void* pdata, int suspend)\r
 {\r
@@ -321,6 +334,12 @@ int usb20host_get_status(int id)
 }\r
 void usb20host_power_enable(int enable)\r
 {\r
+#ifdef CONFIG_RK_CONFIG\r
+        if(enable)\r
+                host_drv_on();\r
+        else\r
+                host_drv_off();\r
+#endif\r
 }\r
 struct dwc_otg_platform_data usb20host_pdata = {\r
     .phyclk = NULL,\r
@@ -347,12 +366,18 @@ struct platform_device device_usb20_host = {
 #endif\r
 static int __init usbdev_init_devices(void)\r
 {\r
+        int ret = 0;\r
 #ifdef CONFIG_USB20_OTG\r
-       platform_device_register(&device_usb20_otg);\r
+       ret = platform_device_register(&device_usb20_otg);\r
+        if(ret < 0){\r
+                printk("%s: platform_device_register(usb20_otg) failed\n", __func__);\r
+                return ret;\r
+        }\r
 #endif\r
 #ifdef CONFIG_USB20_HOST\r
-       platform_device_register(&device_usb20_host);\r
+       ret = platform_device_register(&device_usb20_host);\r
 #endif\r
+        return ret;\r
 }\r
 arch_initcall(usbdev_init_devices);\r
 #endif\r