From 814c2fd800323054bae861b6a7a49f1415d41524 Mon Sep 17 00:00:00 2001 From: yangkai Date: Sun, 25 Mar 2012 15:55:28 +0800 Subject: [PATCH] support usb host for rk30 --- arch/arm/configs/rk30_sdk_defconfig | 3 +++ drivers/usb/dwc_otg/dwc_otg_cil.h | 2 +- drivers/usb/dwc_otg/dwc_otg_driver.c | 3 +++ drivers/usb/dwc_otg/dwc_otg_hcd.c | 23 +++++++++++------------ drivers/usb/dwc_otg/dwc_otg_pcd.c | 2 +- 5 files changed, 19 insertions(+), 14 deletions(-) mode change 100644 => 100755 arch/arm/configs/rk30_sdk_defconfig diff --git a/arch/arm/configs/rk30_sdk_defconfig b/arch/arm/configs/rk30_sdk_defconfig old mode 100644 new mode 100755 index 3fc3d8b264a9..59686eea602f --- a/arch/arm/configs/rk30_sdk_defconfig +++ b/arch/arm/configs/rk30_sdk_defconfig @@ -285,7 +285,10 @@ CONFIG_HID_APPLE=y CONFIG_HID_ELECOM=y CONFIG_HID_MAGICMOUSE=y CONFIG_HID_WACOM=y +CONFIG_USB=y +CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y +CONFIG_USB20_HOST=y CONFIG_USB20_OTG=y CONFIG_MMC=y CONFIG_MMC_UNSAFE_RESUME=y diff --git a/drivers/usb/dwc_otg/dwc_otg_cil.h b/drivers/usb/dwc_otg/dwc_otg_cil.h index a385a26a80ae..a93555ed306a 100755 --- a/drivers/usb/dwc_otg/dwc_otg_cil.h +++ b/drivers/usb/dwc_otg/dwc_otg_cil.h @@ -429,7 +429,7 @@ typedef struct dwc_otg_core_params * Note: The FPGA configuration supports a maximum of 12 host channels. */ int32_t host_channels; -#define dwc_param_host_channels_default 12 +#define dwc_param_host_channels_default 16 /** The number of endpoints in addition to EP0 available for device * mode operations. diff --git a/drivers/usb/dwc_otg/dwc_otg_driver.c b/drivers/usb/dwc_otg/dwc_otg_driver.c index 7cd74ca76899..81d911f62fd6 100755 --- a/drivers/usb/dwc_otg/dwc_otg_driver.c +++ b/drivers/usb/dwc_otg/dwc_otg_driver.c @@ -2012,6 +2012,9 @@ static __devinit int host20_driver_probe(struct platform_device *pdev) cru_set_soft_reset(SOFT_RST_USB_HOST_2_0_PHY, false); cru_set_soft_reset(SOFT_RST_USB_HOST_2_0_CONTROLLER, false); #endif +#ifdef CONFIG_ARCH_RK30 + *(unsigned int*)(USBGRF_UOC1_CON2+4) = ((1<<5)|((1<<5)<<16)); +#endif if (dwc_otg_device == 0) { dev_err(dev, "kmalloc of dwc_otg_device failed\n"); diff --git a/drivers/usb/dwc_otg/dwc_otg_hcd.c b/drivers/usb/dwc_otg/dwc_otg_hcd.c index b13da8738860..3c186646b6f8 100755 --- a/drivers/usb/dwc_otg/dwc_otg_hcd.c +++ b/drivers/usb/dwc_otg/dwc_otg_hcd.c @@ -1396,7 +1396,6 @@ void dwc_otg_hcd_free(struct usb_hcd *_hcd) return; } - #ifdef DEBUG static void dump_urb_info(struct urb *_urb, char* _fn_name) { @@ -1511,17 +1510,6 @@ int dwc_otg_hcd_urb_enqueue(struct usb_hcd *_hcd, return retval; } #endif -#if 1 - /* - * Make sure the start of frame interrupt is enabled now that - * we know we should have queued data. The SOF interrupt - * handler automatically disables itself when idle to reduce - * the number of interrupts. See dwc_otg_hcd_handle_sof_intr() - * for the disable - */ - dwc_modify_reg32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, - DWC_SOF_INTR_MASK); -#endif #ifdef DEBUG if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { dump_urb_info(_urb, "dwc_otg_hcd_urb_enqueue"); @@ -1544,6 +1532,17 @@ int dwc_otg_hcd_urb_enqueue(struct usb_hcd *_hcd, "Error status %d\n", retval); dwc_otg_hcd_qtd_free(qtd); } +#if 1 + /* + * Make sure the start of frame interrupt is enabled now that + * we know we should have queued data. The SOF interrupt + * handler automatically disables itself when idle to reduce + * the number of interrupts. See dwc_otg_hcd_handle_sof_intr() + * for the disable + */ + dwc_modify_reg32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, + DWC_SOF_INTR_MASK); +#endif out: return retval; diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd.c b/drivers/usb/dwc_otg/dwc_otg_pcd.c index 6a2f4473df0e..1749a24f2590 100755 --- a/drivers/usb/dwc_otg/dwc_otg_pcd.c +++ b/drivers/usb/dwc_otg/dwc_otg_pcd.c @@ -1912,7 +1912,7 @@ int dwc_otg_pcd_init(struct device *dev) pcd->vbus_status = 0; pcd->phy_suspend = 0; if(dwc_otg_is_device_mode(core_if)) - mod_timer(&pcd->check_vbus_timer, jiffies+(HZ<<2)); // delay 16 S +(HZ<<4) + mod_timer(&pcd->check_vbus_timer, jiffies+(HZ<<4)); // delay 16 S DWC_PRINT("%s pass,everest\n", __func__); // dwc_otg_pcd_start_vbus_timer( pcd ); return 0; -- 2.34.1