From: 黄涛 Date: Mon, 21 Jan 2013 06:08:50 +0000 (+0800) Subject: rk3188: usb_detect: support bvalid irq wake up system X-Git-Tag: firefly_0821_release~7884 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d91c20f2448795771ef5d289f6424a69890a2021;p=firefly-linux-kernel-4.4.55.git rk3188: usb_detect: support bvalid irq wake up system --- diff --git a/arch/arm/plat-rk/Kconfig b/arch/arm/plat-rk/Kconfig index fd7ac3b5e421..3624aa91109f 100755 --- a/arch/arm/plat-rk/Kconfig +++ b/arch/arm/plat-rk/Kconfig @@ -198,4 +198,9 @@ config RK_CONFIG config RK_TIMER bool +config RK_USB_DETECT_BY_OTG_BVALID + bool "Wakeup system by OTG BVALID interrupt when USB OTG conneted" + depends on USB_GADGET && (ARCH_RK2928 || ARCH_RK3188) + default y if ARCH_RK2928 + endif diff --git a/arch/arm/plat-rk/usb_detect.c b/arch/arm/plat-rk/usb_detect.c index 85bdded7bc74..a3e2e7fabcbf 100755 --- a/arch/arm/plat-rk/usb_detect.c +++ b/arch/arm/plat-rk/usb_detect.c @@ -76,7 +76,7 @@ int __init board_usb_detect_init(unsigned gpio) return 0; } -#if defined(CONFIG_ARCH_RK2928) +#ifdef CONFIG_RK_USB_DETECT_BY_OTG_BVALID #include #include @@ -85,10 +85,12 @@ static irqreturn_t bvalid_irq_handler(int irq, void *dev_id) /* clear irq */ #ifdef CONFIG_ARCH_RK2928 writel_relaxed((1 << 31) | (1 << 15), RK2928_GRF_BASE + GRF_UOC0_CON5); +#ifdef CONFIG_RK_USB_UART + /* usb otg dp/dm switch to usb phy */ + writel_relaxed((3 << (12 + 16)),RK2928_GRF_BASE + GRF_UOC1_CON4); #endif -#ifdef CONFIG_RK_USB_UART - /* usb otg dp/dm switch to usb phy */ - writel_relaxed((3 << (12 + 16)),RK2928_GRF_BASE + GRF_UOC1_CON4); +#elif defined(CONFIG_ARCH_RK3188) + writel_relaxed((1 << 31) | (1 << 15), RK30_GRF_BASE + GRF_UOC0_CON3); #endif wake_lock_timeout(&usb_wakelock, WAKE_LOCK_TIMEOUT); @@ -121,6 +123,8 @@ static int __init bvalid_init(void) /* clear & enable bvalid irq */ #ifdef CONFIG_ARCH_RK2928 writel_relaxed((3 << 30) | (3 << 14), RK2928_GRF_BASE + GRF_UOC0_CON5); +#elif defined(CONFIG_ARCH_RK3188) + writel_relaxed((3 << 30) | (3 << 14), RK30_GRF_BASE + GRF_UOC0_CON3); #endif enable_irq_wake(irq);