static struct android_usb_product usb_products[] = {
{
- .product_id = 0x2810,//0x0c02,//0x4e11,
+ .product_id = 0x2910,//0x0c02,//0x4e11,
.num_functions = ARRAY_SIZE(usb_functions_rockchip),
.functions = usb_functions_rockchip,
},
{
- .product_id = 0x2810,//0x0c02,//0x4e12,
+ .product_id = 0x0c02,//0x0c02,//0x4e12,
.num_functions = ARRAY_SIZE(usb_functions_rockchip_adb),
.functions = usb_functions_rockchip_adb,
},
*/
static struct android_usb_platform_data android_usb_pdata = {
.vendor_id = 0x0bb4,//0x2207,//0x0bb4,//0x18d1,
- .product_id = 0x4e11,//0x2810,//0x4e11,
+ .product_id = 0x4e11,//0x2910,//0x4e11,
.version = 0x0100,
- .product_name = "rk2818 sdk",
+ .product_name = "rk2918 sdk",
.manufacturer_name = "RockChip",
.num_products = ARRAY_SIZE(usb_products),
.products = usb_products,
int dwc_debug(dwc_otg_core_if_t *core_if, int flag)
{
//dwc_otg_core_if_t *core_if = dwc_core_if;
+ #ifdef CONFIG_DWC_OTG_DEVICE_ONLY
+ dwc_otg_pcd_t * pcd;
+ #endif
struct dwc_otg_device *otg_dev;
- dwc_otg_pcd_t * pcd;
switch(flag)
{
case 1:
dwc_otg_dump_host_registers(core_if);
break;
case 2:
+ #ifdef CONFIG_DWC_OTG_DEVICE_ONLY
otg_dev = core_if->otg_dev;
pcd = otg_dev->pcd;
pcd->vbus_status = 0;
+ #endif
break;
case 3:
dump_scu_regs();
/** Resume/Remote wakeup Function */
int (*resume_wakeup) (void *_p);
/** Suspend function */
- int (*suspend) (void *_p);
+ int (*suspend) (void *_p, int suspend);
/** Session Start (SRP) */
int (*session_start) (void *_p);
/** Pointer passed to start() and stop() */
static inline void pcd_suspend( dwc_otg_core_if_t *_core_if )
{
if (_core_if->pcd_cb && _core_if->pcd_cb->suspend ) {
- _core_if->pcd_cb->suspend( _core_if->pcd_cb->p );
+ _core_if->pcd_cb->suspend( _core_if->pcd_cb->p, 0);
}
}
/** Resume the PCD. Helper function for using the PCD callbacks.
otg_dev->hcd->host_enabled = val;
if(val == 0) // enable -> disable
{
- DWC_PRINT("disable host controller:%s\n",pdev->name);
+ DWC_PRINT("disable host controller:%s,id:%d\n",pdev->name,pdev->id);
#if 1
if (_core_if->hcd_cb && _core_if->hcd_cb->disconnect) {
_core_if->hcd_cb->disconnect( _core_if->hcd_cb->p );
}
clk_disable(otg_dev->phyclk);
clk_disable(otg_dev->ahbclk);
+ if (_core_if->hcd_cb && _core_if->hcd_cb->suspend) {
+ _core_if->hcd_cb->suspend( _core_if->hcd_cb->p, val);
+ }
}
else if(val == 1)
{
DWC_PRINT("enable host controller:%s\n",pdev->name);
+ if (_core_if->hcd_cb && _core_if->hcd_cb->suspend) {
+ _core_if->hcd_cb->suspend( _core_if->hcd_cb->p, val);
+ }
clk_enable(otg_dev->phyclk);
clk_enable(otg_dev->ahbclk);
+ mdelay(5);
if (_core_if->hcd_cb && _core_if->hcd_cb->start) {
_core_if->hcd_cb->start( _core_if->hcd_cb->p );
}
dwc_otg_device_t *otg_dev = g_otgdev;
dwc_otg_pcd_t *_pcd = otg_dev->pcd;
return sprintf (_buf, "%d\n", _pcd->conn_en);
+#else
+ return sprintf(_buf, "0\n");
#endif
}
DWC_PRINT("%s %d->%d\n",__func__, _pcd->conn_en, enable);
_pcd->conn_en = enable;
- return _count;
#endif
+ return _count;
}
static DRIVER_ATTR(dwc_otg_conn_en, S_IRUGO|S_IWUSR, dwc_otg_conn_en_show, dwc_otg_conn_en_store);
#ifdef CONFIG_DWC_OTG_DEVICE_ONLY
dwc_otg_enable_global_interrupts( dwc_otg_device->core_if );
#ifdef CONFIG_DWC_OTG_HOST_ONLY
#ifndef CONFIG_USB20_OTG_EN
- clk_disable(otg_dev->phyclk);
- clk_disable(otg_dev->ahbclk);
+ clk_disable(dwc_otg_device->phyclk);
+ clk_disable(dwc_otg_device->ahbclk);
+ *otg_phy_con1 |= (0x01<<2);
+ *otg_phy_con1 &= ~(0x01<<3); // enter suspend.
#endif
#endif
DWC_PRINT("dwc_otg_driver_probe end, everest\n");
retval = -ENOMEM;
goto fail;
}
- DWC_DEBUGPL( DBG_CIL, "base addr for rk28 host11:0x%x\n", (unsigned)dwc_otg_device->base);
+ DWC_DEBUGPL( DBG_CIL, "base addr for rk29 host11:0x%x\n", (unsigned)dwc_otg_device->base);
/*
* Attempt to ensure this device is really a DWC_otg Controller.
* Read and verify the SNPSID register contents. The value should be
*/
dwc_otg_enable_global_interrupts( dwc_otg_device->core_if );
#ifndef CONFIG_USB11_HOST_EN
+ *otg_phy_con1 |= (0x01<<28); // enter suspend.
clk_disable(phyclk);
clk_disable(ahbclk);
#endif
retval = -ENOMEM;
goto fail;
}
- DWC_DEBUGPL( DBG_CIL, "base addr for rk28 host11:0x%x\n", (unsigned)dwc_otg_device->base);
+ DWC_DEBUGPL( DBG_CIL, "base addr for rk29 host20:0x%x\n", (unsigned)dwc_otg_device->base);
/*
* Attempt to ensure this device is really a DWC_otg Controller.
* Read and verify the SNPSID register contents. The value should be
#ifndef CONFIG_USB20_HOST_EN
clk_disable(phyclk);
clk_disable(ahbclk);
+ otgreg &= ~(0x01<<14); // suspend.
+ otgreg |= (0x01<<13); // software control
+ *otg_phy_con1 = otgreg;
#endif
DWC_PRINT("host20_driver_probe end, everest\n");
return 0;
return 1;
}
+/*
+ * suspend: 0 usb phy enable
+ * 1 usb phy suspend
+ */
+static int32_t dwc_otg_phy_suspend_cb( void *_p, int suspend)
+{
+ unsigned int * otg_phy_con1 = (unsigned int*)(USB_GRF_CON);
+
+ if(suspend) {
+ *otg_phy_con1 |= (0x01<<2);
+ *otg_phy_con1 |= (0x01<<3); // exit suspend.
+ *otg_phy_con1 &= ~(0x01<<2);
+
+ DWC_DEBUGPL(DBG_PCDV, "enable usb phy\n");
+ }
+ else
+ {
+ *otg_phy_con1 |= (0x01<<2);
+ *otg_phy_con1 &= ~(0x01<<3); // enter suspend.
+ DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
+ }
+
+ return suspend;
+}
+
/**
* HCD Callback structure for handling mode switching.
*/
.stop = dwc_otg_hcd_stop_cb,
.disconnect = dwc_otg_hcd_disconnect_cb,
.session_start = dwc_otg_hcd_session_start_cb,
+ .suspend = dwc_otg_phy_suspend_cb,
.p = 0,//hcd
};
}
#ifdef CONFIG_USB11_HOST
+/*
+ * suspend: 0 usb phy enable
+ * 1 usb phy suspend
+ */
+static int32_t host11_phy_suspend_cb( void *_p, int suspend)
+{
+ unsigned int * otg_phy_con1 = (unsigned int*)(USB_GRF_CON);
+
+ if(suspend) {
+ *otg_phy_con1 &= ~(0x01<<28);
+ DWC_DEBUGPL(DBG_PCDV, "enable usb phy\n");
+ }
+ else
+ {
+ *otg_phy_con1 |= (0x01<<28);
+ DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
+ }
+
+ return suspend;
+}
static dwc_otg_cil_callbacks_t host11_cil_callbacks = {
.start = dwc_otg_hcd_start_cb,
.stop = dwc_otg_hcd_stop_cb,
.disconnect = dwc_otg_hcd_disconnect_cb,
.session_start = dwc_otg_hcd_session_start_cb,
+ .suspend = host11_phy_suspend_cb,
.p = 0,//hcd
};
}
#endif
#ifdef CONFIG_USB20_HOST
+
+/*
+ * suspend: 0 usb phy enable
+ * 1 usb phy suspend
+ */
+static int32_t host20_phy_suspend_cb( void *_p, int suspend)
+{
+ unsigned int * otg_phy_con1 = (unsigned int*)(USB_GRF_CON);
+ uint32_t regval;
+
+ regval = *otg_phy_con1;
+
+ if(suspend) {
+ regval |= (0x01<<14); // exit suspend.
+ regval &= ~(0x01<<13);
+
+ DWC_DEBUGPL(DBG_PCDV, "enable usb phy\n");
+ }
+ else
+ {
+ regval &= ~(0x01<<14); // exit suspend.
+ regval |= (0x01<<13); // software control
+ DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
+ }
+ *otg_phy_con1 = regval;
+
+ return suspend;
+}
+
static dwc_otg_cil_callbacks_t host20_cil_callbacks = {
.start = dwc_otg_hcd_start_cb,
.stop = dwc_otg_hcd_stop_cb,
.disconnect = dwc_otg_hcd_disconnect_cb,
.session_start = dwc_otg_hcd_session_start_cb,
+ .suspend = host20_phy_suspend_cb,
.p = 0,//hcd
};
/** @{ */
extern int __init dwc_otg_hcd_init(struct device *_dev);
extern void dwc_otg_hcd_remove(struct device *_dev);
-extern int __init rk28_host11_hcd_init(struct device *_dev);
/** @} */
/** @name Linux HC Driver API Functions */
*
* @param _p void pointer to the <code>dwc_otg_pcd_t</code>
*/
-static int32_t dwc_otg_pcd_suspend_cb( void *_p )
+static int32_t dwc_otg_pcd_suspend_cb( void *_p ,int suspend)
{
dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *)_p;
#ifdef CONFIG_ANDROID_POWER