diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-05-06 21:29:25 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-05-06 21:29:25 -0400 |
commit | 1ed31d6db90d51010545921e59d369d2f92b7ac2 (patch) | |
tree | 358a0b346bc8135cd5e53700eb44308b1a7c8c5b /drivers/usb/musb | |
parent | ceba1abcb00b0ef0b1efcd715285f6e05523edef (diff) | |
parent | 722154e4cacf015161efe60009ae9be23d492296 (diff) |
Merge commit 'origin/master' into next
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/Kconfig | 2 | ||||
-rw-r--r-- | drivers/usb/musb/Makefile | 2 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.c | 8 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.c | 77 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.h | 2 | ||||
-rw-r--r-- | drivers/usb/musb/musb_host.c | 1 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 13 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010_omap.c | 22 |
10 files changed, 77 insertions, 55 deletions
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index b4c783c284ba..07fe490b44d8 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -42,7 +42,7 @@ config USB_MUSB_SOC | |||
42 | default y if (BF52x && !BF522 && !BF523) | 42 | default y if (BF52x && !BF522 && !BF523) |
43 | 43 | ||
44 | comment "DaVinci 35x and 644x USB support" | 44 | comment "DaVinci 35x and 644x USB support" |
45 | depends on USB_MUSB_HDRC && ARCH_DAVINCI | 45 | depends on USB_MUSB_HDRC && ARCH_DAVINCI_DMx |
46 | 46 | ||
47 | comment "OMAP 243x high speed USB support" | 47 | comment "OMAP 243x high speed USB support" |
48 | depends on USB_MUSB_HDRC && ARCH_OMAP2430 | 48 | depends on USB_MUSB_HDRC && ARCH_OMAP2430 |
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index 85710ccc1887..3a485dabebbb 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile | |||
@@ -6,7 +6,7 @@ musb_hdrc-objs := musb_core.o | |||
6 | 6 | ||
7 | obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o | 7 | obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o |
8 | 8 | ||
9 | ifeq ($(CONFIG_ARCH_DAVINCI),y) | 9 | ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y) |
10 | musb_hdrc-objs += davinci.o | 10 | musb_hdrc-objs += davinci.o |
11 | endif | 11 | endif |
12 | 12 | ||
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 719a22d664ef..ec8d324237f6 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -172,13 +172,7 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci) | |||
172 | 172 | ||
173 | spin_unlock_irqrestore(&musb->lock, flags); | 173 | spin_unlock_irqrestore(&musb->lock, flags); |
174 | 174 | ||
175 | /* REVISIT we sometimes get spurious IRQs on g_ep0 | 175 | return retval; |
176 | * not clear why... fall in BF54x too. | ||
177 | */ | ||
178 | if (retval != IRQ_HANDLED) | ||
179 | DBG(5, "spurious?\n"); | ||
180 | |||
181 | return IRQ_HANDLED; | ||
182 | } | 176 | } |
183 | 177 | ||
184 | static void musb_conn_timer_handler(unsigned long _musb) | 178 | static void musb_conn_timer_handler(unsigned long _musb) |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 29bce5c0fd10..ce2e16fee0df 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -444,6 +444,8 @@ int __init musb_platform_init(struct musb *musb) | |||
444 | return 0; | 444 | return 0; |
445 | 445 | ||
446 | fail: | 446 | fail: |
447 | clk_disable(musb->clock); | ||
448 | |||
447 | usb_nop_xceiv_unregister(); | 449 | usb_nop_xceiv_unregister(); |
448 | return -ENODEV; | 450 | return -ENODEV; |
449 | } | 451 | } |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0e8b8ab1d168..705cc4ad8737 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -965,10 +965,8 @@ static void musb_shutdown(struct platform_device *pdev) | |||
965 | spin_lock_irqsave(&musb->lock, flags); | 965 | spin_lock_irqsave(&musb->lock, flags); |
966 | musb_platform_disable(musb); | 966 | musb_platform_disable(musb); |
967 | musb_generic_disable(musb); | 967 | musb_generic_disable(musb); |
968 | if (musb->clock) { | 968 | if (musb->clock) |
969 | clk_put(musb->clock); | 969 | clk_put(musb->clock); |
970 | musb->clock = NULL; | ||
971 | } | ||
972 | spin_unlock_irqrestore(&musb->lock, flags); | 970 | spin_unlock_irqrestore(&musb->lock, flags); |
973 | 971 | ||
974 | /* FIXME power down */ | 972 | /* FIXME power down */ |
@@ -1853,15 +1851,6 @@ static void musb_free(struct musb *musb) | |||
1853 | put_device(musb->xceiv->dev); | 1851 | put_device(musb->xceiv->dev); |
1854 | #endif | 1852 | #endif |
1855 | 1853 | ||
1856 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
1857 | musb_platform_exit(musb); | ||
1858 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
1859 | |||
1860 | if (musb->clock) { | ||
1861 | clk_disable(musb->clock); | ||
1862 | clk_put(musb->clock); | ||
1863 | } | ||
1864 | |||
1865 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 1854 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
1866 | usb_put_hcd(musb_to_hcd(musb)); | 1855 | usb_put_hcd(musb_to_hcd(musb)); |
1867 | #else | 1856 | #else |
@@ -1889,8 +1878,10 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1889 | */ | 1878 | */ |
1890 | if (!plat) { | 1879 | if (!plat) { |
1891 | dev_dbg(dev, "no platform_data?\n"); | 1880 | dev_dbg(dev, "no platform_data?\n"); |
1892 | return -ENODEV; | 1881 | status = -ENODEV; |
1882 | goto fail0; | ||
1893 | } | 1883 | } |
1884 | |||
1894 | switch (plat->mode) { | 1885 | switch (plat->mode) { |
1895 | case MUSB_HOST: | 1886 | case MUSB_HOST: |
1896 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 1887 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
@@ -1912,13 +1903,16 @@ bad_config: | |||
1912 | #endif | 1903 | #endif |
1913 | default: | 1904 | default: |
1914 | dev_err(dev, "incompatible Kconfig role setting\n"); | 1905 | dev_err(dev, "incompatible Kconfig role setting\n"); |
1915 | return -EINVAL; | 1906 | status = -EINVAL; |
1907 | goto fail0; | ||
1916 | } | 1908 | } |
1917 | 1909 | ||
1918 | /* allocate */ | 1910 | /* allocate */ |
1919 | musb = allocate_instance(dev, plat->config, ctrl); | 1911 | musb = allocate_instance(dev, plat->config, ctrl); |
1920 | if (!musb) | 1912 | if (!musb) { |
1921 | return -ENOMEM; | 1913 | status = -ENOMEM; |
1914 | goto fail0; | ||
1915 | } | ||
1922 | 1916 | ||
1923 | spin_lock_init(&musb->lock); | 1917 | spin_lock_init(&musb->lock); |
1924 | musb->board_mode = plat->mode; | 1918 | musb->board_mode = plat->mode; |
@@ -1936,7 +1930,7 @@ bad_config: | |||
1936 | if (IS_ERR(musb->clock)) { | 1930 | if (IS_ERR(musb->clock)) { |
1937 | status = PTR_ERR(musb->clock); | 1931 | status = PTR_ERR(musb->clock); |
1938 | musb->clock = NULL; | 1932 | musb->clock = NULL; |
1939 | goto fail; | 1933 | goto fail1; |
1940 | } | 1934 | } |
1941 | } | 1935 | } |
1942 | 1936 | ||
@@ -1955,12 +1949,12 @@ bad_config: | |||
1955 | */ | 1949 | */ |
1956 | musb->isr = generic_interrupt; | 1950 | musb->isr = generic_interrupt; |
1957 | status = musb_platform_init(musb); | 1951 | status = musb_platform_init(musb); |
1958 | |||
1959 | if (status < 0) | 1952 | if (status < 0) |
1960 | goto fail; | 1953 | goto fail2; |
1954 | |||
1961 | if (!musb->isr) { | 1955 | if (!musb->isr) { |
1962 | status = -ENODEV; | 1956 | status = -ENODEV; |
1963 | goto fail2; | 1957 | goto fail3; |
1964 | } | 1958 | } |
1965 | 1959 | ||
1966 | #ifndef CONFIG_MUSB_PIO_ONLY | 1960 | #ifndef CONFIG_MUSB_PIO_ONLY |
@@ -1986,7 +1980,7 @@ bad_config: | |||
1986 | ? MUSB_CONTROLLER_MHDRC | 1980 | ? MUSB_CONTROLLER_MHDRC |
1987 | : MUSB_CONTROLLER_HDRC, musb); | 1981 | : MUSB_CONTROLLER_HDRC, musb); |
1988 | if (status < 0) | 1982 | if (status < 0) |
1989 | goto fail2; | 1983 | goto fail3; |
1990 | 1984 | ||
1991 | #ifdef CONFIG_USB_MUSB_OTG | 1985 | #ifdef CONFIG_USB_MUSB_OTG |
1992 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); | 1986 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); |
@@ -1999,7 +1993,7 @@ bad_config: | |||
1999 | if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { | 1993 | if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { |
2000 | dev_err(dev, "request_irq %d failed!\n", nIrq); | 1994 | dev_err(dev, "request_irq %d failed!\n", nIrq); |
2001 | status = -ENODEV; | 1995 | status = -ENODEV; |
2002 | goto fail2; | 1996 | goto fail3; |
2003 | } | 1997 | } |
2004 | musb->nIrq = nIrq; | 1998 | musb->nIrq = nIrq; |
2005 | /* FIXME this handles wakeup irqs wrong */ | 1999 | /* FIXME this handles wakeup irqs wrong */ |
@@ -2039,8 +2033,6 @@ bad_config: | |||
2039 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2033 | musb->xceiv->state = OTG_STATE_A_IDLE; |
2040 | 2034 | ||
2041 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); | 2035 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); |
2042 | if (status) | ||
2043 | goto fail; | ||
2044 | 2036 | ||
2045 | DBG(1, "%s mode, status %d, devctl %02x %c\n", | 2037 | DBG(1, "%s mode, status %d, devctl %02x %c\n", |
2046 | "HOST", status, | 2038 | "HOST", status, |
@@ -2055,8 +2047,6 @@ bad_config: | |||
2055 | musb->xceiv->state = OTG_STATE_B_IDLE; | 2047 | musb->xceiv->state = OTG_STATE_B_IDLE; |
2056 | 2048 | ||
2057 | status = musb_gadget_setup(musb); | 2049 | status = musb_gadget_setup(musb); |
2058 | if (status) | ||
2059 | goto fail; | ||
2060 | 2050 | ||
2061 | DBG(1, "%s mode, status %d, dev%02x\n", | 2051 | DBG(1, "%s mode, status %d, dev%02x\n", |
2062 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", | 2052 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", |
@@ -2064,12 +2054,14 @@ bad_config: | |||
2064 | musb_readb(musb->mregs, MUSB_DEVCTL)); | 2054 | musb_readb(musb->mregs, MUSB_DEVCTL)); |
2065 | 2055 | ||
2066 | } | 2056 | } |
2057 | if (status < 0) | ||
2058 | goto fail3; | ||
2067 | 2059 | ||
2068 | #ifdef CONFIG_SYSFS | 2060 | #ifdef CONFIG_SYSFS |
2069 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); | 2061 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); |
2070 | #endif | ||
2071 | if (status) | 2062 | if (status) |
2072 | goto fail2; | 2063 | goto fail4; |
2064 | #endif | ||
2073 | 2065 | ||
2074 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", | 2066 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", |
2075 | ({char *s; | 2067 | ({char *s; |
@@ -2085,17 +2077,29 @@ bad_config: | |||
2085 | 2077 | ||
2086 | return 0; | 2078 | return 0; |
2087 | 2079 | ||
2088 | fail2: | 2080 | fail4: |
2081 | if (!is_otg_enabled(musb) && is_host_enabled(musb)) | ||
2082 | usb_remove_hcd(musb_to_hcd(musb)); | ||
2083 | else | ||
2084 | musb_gadget_cleanup(musb); | ||
2085 | |||
2086 | fail3: | ||
2087 | if (musb->irq_wake) | ||
2088 | device_init_wakeup(dev, 0); | ||
2089 | musb_platform_exit(musb); | 2089 | musb_platform_exit(musb); |
2090 | fail: | ||
2091 | dev_err(musb->controller, | ||
2092 | "musb_init_controller failed with status %d\n", status); | ||
2093 | 2090 | ||
2091 | fail2: | ||
2094 | if (musb->clock) | 2092 | if (musb->clock) |
2095 | clk_put(musb->clock); | 2093 | clk_put(musb->clock); |
2096 | device_init_wakeup(dev, 0); | 2094 | |
2095 | fail1: | ||
2096 | dev_err(musb->controller, | ||
2097 | "musb_init_controller failed with status %d\n", status); | ||
2098 | |||
2097 | musb_free(musb); | 2099 | musb_free(musb); |
2098 | 2100 | ||
2101 | fail0: | ||
2102 | |||
2099 | return status; | 2103 | return status; |
2100 | 2104 | ||
2101 | } | 2105 | } |
@@ -2132,7 +2136,6 @@ static int __init musb_probe(struct platform_device *pdev) | |||
2132 | /* clobbered by use_dma=n */ | 2136 | /* clobbered by use_dma=n */ |
2133 | orig_dma_mask = dev->dma_mask; | 2137 | orig_dma_mask = dev->dma_mask; |
2134 | #endif | 2138 | #endif |
2135 | |||
2136 | status = musb_init_controller(dev, irq, base); | 2139 | status = musb_init_controller(dev, irq, base); |
2137 | if (status < 0) | 2140 | if (status < 0) |
2138 | iounmap(base); | 2141 | iounmap(base); |
@@ -2155,6 +2158,10 @@ static int __exit musb_remove(struct platform_device *pdev) | |||
2155 | if (musb->board_mode == MUSB_HOST) | 2158 | if (musb->board_mode == MUSB_HOST) |
2156 | usb_remove_hcd(musb_to_hcd(musb)); | 2159 | usb_remove_hcd(musb_to_hcd(musb)); |
2157 | #endif | 2160 | #endif |
2161 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
2162 | musb_platform_exit(musb); | ||
2163 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
2164 | |||
2158 | musb_free(musb); | 2165 | musb_free(musb); |
2159 | iounmap(ctrl_base); | 2166 | iounmap(ctrl_base); |
2160 | device_init_wakeup(&pdev->dev, 0); | 2167 | device_init_wakeup(&pdev->dev, 0); |
@@ -2176,6 +2183,7 @@ void musb_save_context(struct musb *musb) | |||
2176 | if (is_host_enabled(musb)) { | 2183 | if (is_host_enabled(musb)) { |
2177 | musb_context.frame = musb_readw(musb_base, MUSB_FRAME); | 2184 | musb_context.frame = musb_readw(musb_base, MUSB_FRAME); |
2178 | musb_context.testmode = musb_readb(musb_base, MUSB_TESTMODE); | 2185 | musb_context.testmode = musb_readb(musb_base, MUSB_TESTMODE); |
2186 | musb_context.busctl = musb_read_ulpi_buscontrol(musb->mregs); | ||
2179 | } | 2187 | } |
2180 | musb_context.power = musb_readb(musb_base, MUSB_POWER); | 2188 | musb_context.power = musb_readb(musb_base, MUSB_POWER); |
2181 | musb_context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE); | 2189 | musb_context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE); |
@@ -2247,6 +2255,7 @@ void musb_restore_context(struct musb *musb) | |||
2247 | if (is_host_enabled(musb)) { | 2255 | if (is_host_enabled(musb)) { |
2248 | musb_writew(musb_base, MUSB_FRAME, musb_context.frame); | 2256 | musb_writew(musb_base, MUSB_FRAME, musb_context.frame); |
2249 | musb_writeb(musb_base, MUSB_TESTMODE, musb_context.testmode); | 2257 | musb_writeb(musb_base, MUSB_TESTMODE, musb_context.testmode); |
2258 | musb_write_ulpi_buscontrol(musb->mregs, musb_context.busctl); | ||
2250 | } | 2259 | } |
2251 | musb_writeb(musb_base, MUSB_POWER, musb_context.power); | 2260 | musb_writeb(musb_base, MUSB_POWER, musb_context.power); |
2252 | musb_writew(musb_base, MUSB_INTRTXE, musb_context.intrtxe); | 2261 | musb_writew(musb_base, MUSB_INTRTXE, musb_context.intrtxe); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index cd9f4a9a06c6..ac17b004909b 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -478,7 +478,7 @@ struct musb_context_registers { | |||
478 | u16 frame; | 478 | u16 frame; |
479 | u8 index, testmode; | 479 | u8 index, testmode; |
480 | 480 | ||
481 | u8 devctl, misc; | 481 | u8 devctl, busctl, misc; |
482 | 482 | ||
483 | struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; | 483 | struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; |
484 | }; | 484 | }; |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index dec896e888db..877d20b1dff9 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2042,6 +2042,7 @@ static int musb_urb_enqueue( | |||
2042 | * odd, rare, error prone, but legal. | 2042 | * odd, rare, error prone, but legal. |
2043 | */ | 2043 | */ |
2044 | kfree(qh); | 2044 | kfree(qh); |
2045 | qh = NULL; | ||
2045 | ret = 0; | 2046 | ret = 0; |
2046 | } else | 2047 | } else |
2047 | ret = musb_schedule(musb, qh, | 2048 | ret = musb_schedule(musb, qh, |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 490cdf15ccb6..82592633502f 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -331,8 +331,5 @@ int musb_platform_exit(struct musb *musb) | |||
331 | 331 | ||
332 | musb_platform_suspend(musb); | 332 | musb_platform_suspend(musb); |
333 | 333 | ||
334 | clk_put(musb->clock); | ||
335 | musb->clock = NULL; | ||
336 | |||
337 | return 0; | 334 | return 0; |
338 | } | 335 | } |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index ab776a8d98ca..60d3938cafcf 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -29,6 +29,19 @@ static void tusb_source_power(struct musb *musb, int is_on); | |||
29 | #define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) | 29 | #define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) |
30 | #define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) | 30 | #define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) |
31 | 31 | ||
32 | #ifdef CONFIG_PM | ||
33 | /* REVISIT: These should be only needed if somebody implements off idle */ | ||
34 | void musb_platform_save_context(struct musb *musb, | ||
35 | struct musb_context_registers *musb_context) | ||
36 | { | ||
37 | } | ||
38 | |||
39 | void musb_platform_restore_context(struct musb *musb, | ||
40 | struct musb_context_registers *musb_context) | ||
41 | { | ||
42 | } | ||
43 | #endif | ||
44 | |||
32 | /* | 45 | /* |
33 | * Checks the revision. We need to use the DMA register as 3.0 does not | 46 | * Checks the revision. We need to use the DMA register as 3.0 does not |
34 | * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. | 47 | * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. |
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c index 5afa070d7dc9..c061a88f2b0f 100644 --- a/drivers/usb/musb/tusb6010_omap.c +++ b/drivers/usb/musb/tusb6010_omap.c | |||
@@ -39,7 +39,7 @@ struct tusb_omap_dma_ch { | |||
39 | 39 | ||
40 | struct tusb_omap_dma *tusb_dma; | 40 | struct tusb_omap_dma *tusb_dma; |
41 | 41 | ||
42 | void __iomem *dma_addr; | 42 | dma_addr_t dma_addr; |
43 | 43 | ||
44 | u32 len; | 44 | u32 len; |
45 | u16 packet_sz; | 45 | u16 packet_sz; |
@@ -126,6 +126,7 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data) | |||
126 | struct tusb_omap_dma_ch *chdat = to_chdat(channel); | 126 | struct tusb_omap_dma_ch *chdat = to_chdat(channel); |
127 | struct tusb_omap_dma *tusb_dma = chdat->tusb_dma; | 127 | struct tusb_omap_dma *tusb_dma = chdat->tusb_dma; |
128 | struct musb *musb = chdat->musb; | 128 | struct musb *musb = chdat->musb; |
129 | struct device *dev = musb->controller; | ||
129 | struct musb_hw_ep *hw_ep = chdat->hw_ep; | 130 | struct musb_hw_ep *hw_ep = chdat->hw_ep; |
130 | void __iomem *ep_conf = hw_ep->conf; | 131 | void __iomem *ep_conf = hw_ep->conf; |
131 | void __iomem *mbase = musb->mregs; | 132 | void __iomem *mbase = musb->mregs; |
@@ -173,13 +174,15 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data) | |||
173 | DBG(3, "Using PIO for remaining %lu bytes\n", pio); | 174 | DBG(3, "Using PIO for remaining %lu bytes\n", pio); |
174 | buf = phys_to_virt((u32)chdat->dma_addr) + chdat->transfer_len; | 175 | buf = phys_to_virt((u32)chdat->dma_addr) + chdat->transfer_len; |
175 | if (chdat->tx) { | 176 | if (chdat->tx) { |
176 | dma_cache_maint(phys_to_virt((u32)chdat->dma_addr), | 177 | dma_unmap_single(dev, chdat->dma_addr, |
177 | chdat->transfer_len, DMA_TO_DEVICE); | 178 | chdat->transfer_len, |
179 | DMA_TO_DEVICE); | ||
178 | musb_write_fifo(hw_ep, pio, buf); | 180 | musb_write_fifo(hw_ep, pio, buf); |
179 | } else { | 181 | } else { |
182 | dma_unmap_single(dev, chdat->dma_addr, | ||
183 | chdat->transfer_len, | ||
184 | DMA_FROM_DEVICE); | ||
180 | musb_read_fifo(hw_ep, pio, buf); | 185 | musb_read_fifo(hw_ep, pio, buf); |
181 | dma_cache_maint(phys_to_virt((u32)chdat->dma_addr), | ||
182 | chdat->transfer_len, DMA_FROM_DEVICE); | ||
183 | } | 186 | } |
184 | channel->actual_len += pio; | 187 | channel->actual_len += pio; |
185 | } | 188 | } |
@@ -224,6 +227,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, | |||
224 | struct tusb_omap_dma_ch *chdat = to_chdat(channel); | 227 | struct tusb_omap_dma_ch *chdat = to_chdat(channel); |
225 | struct tusb_omap_dma *tusb_dma = chdat->tusb_dma; | 228 | struct tusb_omap_dma *tusb_dma = chdat->tusb_dma; |
226 | struct musb *musb = chdat->musb; | 229 | struct musb *musb = chdat->musb; |
230 | struct device *dev = musb->controller; | ||
227 | struct musb_hw_ep *hw_ep = chdat->hw_ep; | 231 | struct musb_hw_ep *hw_ep = chdat->hw_ep; |
228 | void __iomem *mbase = musb->mregs; | 232 | void __iomem *mbase = musb->mregs; |
229 | void __iomem *ep_conf = hw_ep->conf; | 233 | void __iomem *ep_conf = hw_ep->conf; |
@@ -299,14 +303,16 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, | |||
299 | chdat->packet_sz = packet_sz; | 303 | chdat->packet_sz = packet_sz; |
300 | chdat->len = len; | 304 | chdat->len = len; |
301 | channel->actual_len = 0; | 305 | channel->actual_len = 0; |
302 | chdat->dma_addr = (void __iomem *)dma_addr; | 306 | chdat->dma_addr = dma_addr; |
303 | channel->status = MUSB_DMA_STATUS_BUSY; | 307 | channel->status = MUSB_DMA_STATUS_BUSY; |
304 | 308 | ||
305 | /* Since we're recycling dma areas, we need to clean or invalidate */ | 309 | /* Since we're recycling dma areas, we need to clean or invalidate */ |
306 | if (chdat->tx) | 310 | if (chdat->tx) |
307 | dma_cache_maint(phys_to_virt(dma_addr), len, DMA_TO_DEVICE); | 311 | dma_map_single(dev, phys_to_virt(dma_addr), len, |
312 | DMA_TO_DEVICE); | ||
308 | else | 313 | else |
309 | dma_cache_maint(phys_to_virt(dma_addr), len, DMA_FROM_DEVICE); | 314 | dma_map_single(dev, phys_to_virt(dma_addr), len, |
315 | DMA_FROM_DEVICE); | ||
310 | 316 | ||
311 | /* Use 16-bit transfer if dma_addr is not 32-bit aligned */ | 317 | /* Use 16-bit transfer if dma_addr is not 32-bit aligned */ |
312 | if ((dma_addr & 0x3) == 0) { | 318 | if ((dma_addr & 0x3) == 0) { |