From: wlf Date: Thu, 17 Jan 2013 08:10:07 +0000 (+0800) Subject: USB: support rk3168/rk3188 usb host X-Git-Tag: firefly_0821_release~7902 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5b9711e414da970ea81ef300dbe7fb5ad9137611;p=firefly-linux-kernel-4.4.55.git USB: support rk3168/rk3188 usb host --- diff --git a/drivers/usb/dwc_otg/dwc_otg_cil.c b/drivers/usb/dwc_otg/dwc_otg_cil.c index c61117fa15c9..5ea7ffa02a27 100755 --- a/drivers/usb/dwc_otg/dwc_otg_cil.c +++ b/drivers/usb/dwc_otg/dwc_otg_cil.c @@ -723,7 +723,7 @@ void dwc_otg_core_dev_init(dwc_otg_core_if_t *_core_if) dwc_write_reg32( &global_regs->dptxfsiz_dieptxf[1], 0x00100320 ); //ep3 tx fifo dwc_write_reg32( &global_regs->dptxfsiz_dieptxf[2], 0x00800330 ); //ep5 tx fifo #endif -#ifdef CONFIG_ARCH_RK30 +#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188) /* Configure data FIFO sizes, RK30 otg has 0x3cc dwords total */ dwc_write_reg32( &global_regs->grxfsiz, 0x00000120 ); dwc_write_reg32( &global_regs->gnptxfsiz, 0x00100120 ); //ep0 tx fifo diff --git a/drivers/usb/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/dwc_otg/dwc_otg_hcd_queue.c index ae18b36a0ea9..a0b935762658 100755 --- a/drivers/usb/dwc_otg/dwc_otg_hcd_queue.c +++ b/drivers/usb/dwc_otg/dwc_otg_hcd_queue.c @@ -247,7 +247,7 @@ static int periodic_channel_available(dwc_otg_hcd_t *_hcd) * non-periodic transactions. */ int status; -#ifdef CONFIG_ARCH_RK30 +#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188) int num_channels; num_channels = _hcd->core_if->core_params->host_channels; diff --git a/drivers/usb/dwc_otg/usbdev_rk30.c b/drivers/usb/dwc_otg/usbdev_rk30.c index 5cb03b98d2e7..02aeecc5ef20 100755 --- a/drivers/usb/dwc_otg/usbdev_rk30.c +++ b/drivers/usb/dwc_otg/usbdev_rk30.c @@ -12,19 +12,24 @@ #include "usbdev_rk.h" #include "dwc_otg_regs.h" -#ifdef CONFIG_ARCH_RK30 +#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188) #define GRF_REG_BASE RK30_GRF_BASE #define USBOTG_SIZE RK30_USBOTG20_SIZE -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) #define USBGRF_SOC_STATUS0 (GRF_REG_BASE+0xac) #define USBGRF_UOC0_CON2 (GRF_REG_BASE+0x114) #define USBGRF_UOC0_CON3 (GRF_REG_BASE+0x118) #define USBGRF_UOC1_CON2 (GRF_REG_BASE+0x124) #define USBGRF_UOC1_CON3 (GRF_REG_BASE+0x128) +#if defined(CONFIG_SOC_RK3066B) || defined(CONFIG_SOC_RK3108) #define RK3066B_HOST_DRV_VBUS RK30_PIN0_PD7 #define RK3066B_OTG_DRV_VBUS RK30_PIN0_PD6 +#elif defined(CONFIG_SOC_RK3168) || defined(CONFIG_ARCH_RK3188) +#define RK3066B_HOST_DRV_VBUS RK30_PIN0_PC0 +#define RK3066B_OTG_DRV_VBUS RK30_PIN3_PD5 +#endif #else #define USBGRF_SOC_STATUS0 (GRF_REG_BASE+0x15c) @@ -101,7 +106,7 @@ void usb20otg_hw_init(void) { #ifndef CONFIG_USB20_HOST // close USB 2.0 HOST phy and clock -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON2); unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC1_CON3); *otg_phy_con1 = (0x01<<2)|((0x01<<2)<<16); //enable soft control @@ -114,7 +119,7 @@ void usb20otg_hw_init(void) // usb phy config init // other haredware init -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) //GPIO init gpio_request(RK3066B_OTG_DRV_VBUS, NULL); gpio_direction_output(RK3066B_OTG_DRV_VBUS, GPIO_LOW); @@ -125,7 +130,7 @@ void usb20otg_hw_init(void) void usb20otg_phy_suspend(void* pdata, int suspend) { -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) struct dwc_otg_platform_data *usbpdata=pdata; unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC0_CON2); unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC0_CON3); @@ -191,7 +196,7 @@ int usb20otg_get_status(int id) unsigned int usbgrf_status = *(unsigned int*)(USBGRF_SOC_STATUS0); switch(id) { -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) case USB_STATUS_BVABLID: // bvalid in grf ret = (usbgrf_status &(1<<10)); @@ -224,7 +229,7 @@ int usb20otg_get_status(int id) return ret; } -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) void usb20otg_power_enable(int enable) { unsigned int usbgrf_status = *(unsigned int*)(USBGRF_SOC_STATUS0); @@ -250,7 +255,7 @@ struct dwc_otg_platform_data usb20otg_pdata = { .clock_init=usb20otg_clock_init, .clock_enable=usb20otg_clock_enable, .get_status=usb20otg_get_status, -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) .power_enable=usb20otg_power_enable, #endif }; @@ -284,7 +289,7 @@ void usb20host_hw_init(void) // usb phy config init // other haredware init -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) gpio_request(RK3066B_HOST_DRV_VBUS, NULL); gpio_direction_output(RK3066B_HOST_DRV_VBUS, GPIO_HIGH); #else @@ -293,7 +298,7 @@ void usb20host_hw_init(void) } void usb20host_phy_suspend(void* pdata, int suspend) { -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) struct dwc_otg_platform_data *usbpdata=pdata; unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON2); unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC1_CON3); @@ -363,7 +368,7 @@ int usb20host_get_status(int id) unsigned int usbgrf_status = *(unsigned int*)(USBGRF_SOC_STATUS0); switch(id) { -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) case USB_STATUS_BVABLID: // bvalid in grf ret = (usbgrf_status &(1<<17)); @@ -396,7 +401,7 @@ int usb20host_get_status(int id) return ret; } -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) void usb20host_power_enable(int enable) { @@ -429,7 +434,7 @@ struct dwc_otg_platform_data usb20host_pdata = { .clock_init=usb20host_clock_init, .clock_enable=usb20host_clock_enable, .get_status=usb20host_get_status, -#ifdef CONFIG_ARCH_RK3066B +#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) .power_enable=usb20host_power_enable, #endif };