Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Apr 2010 17:16:42 +0000 (10:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Apr 2010 17:16:42 +0000 (10:16 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
  serial: drivers/serial/pmac_zilog.c: add missing unlock
  serial: 8250_pnp - add Fujitsu Wacom device
  tty: Fix regressions in the char driver conversion

36 files changed:
Documentation/spi/spidev_test.c
arch/arm/plat-omap/include/plat/usb.h
drivers/edac/edac_mce_amd.c
drivers/gpio/gpiolib.c
drivers/of/of_mdio.c
drivers/serial/mpc52xx_uart.c
drivers/spi/omap2_mcspi.c
drivers/spi/spi.c
drivers/usb/class/cdc-acm.c
drivers/usb/core/Kconfig
drivers/usb/core/generic.c
drivers/usb/core/inode.c
drivers/usb/core/usb.c
drivers/usb/gadget/s3c-hsotg.c
drivers/usb/host/ohci-at91.c
drivers/usb/host/ohci-hub.c
drivers/usb/host/oxu210hp-hcd.c
drivers/usb/host/sl811-hcd.c
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci.h
drivers/usb/musb/Kconfig
drivers/usb/musb/Makefile
drivers/usb/musb/blackfin.c
drivers/usb/musb/davinci.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_core.h
drivers/usb/musb/musb_host.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/tusb6010.c
drivers/usb/musb/tusb6010_omap.c
drivers/usb/serial/option.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/pl2303.h
drivers/usb/serial/ti_usb_3410_5052.c
fs/notify/inotify/Kconfig
include/linux/usb.h

index 10abd37..16feda9 100644 (file)
@@ -58,7 +58,7 @@ static void transfer(int fd)
        };
 
        ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
-       if (ret == 1)
+       if (ret < 1)
                pabort("can't send spi message");
 
        for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
index 568578d..876ca8d 100644 (file)
@@ -46,7 +46,7 @@ struct ehci_hcd_omap_platform_data {
 struct omap_musb_board_data {
        u8      interface_type;
        u8      mode;
-       u     power;
+       u16     power;
 };
 
 enum musb_interface    {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
index f5b6d9f..97e64bc 100644 (file)
@@ -294,7 +294,6 @@ wrong_ls_mce:
 void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
 {
        u32 ec  = ERROR_CODE(regs->nbsl);
-       u32 xec = EXT_ERROR_CODE(regs->nbsl);
 
        if (!handle_errors)
                return;
@@ -324,7 +323,7 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
                pr_cont("\n");
        }
 
-       pr_emerg("%s.\n", EXT_ERR_MSG(xec));
+       pr_emerg("%s.\n", EXT_ERR_MSG(regs->nbsl));
 
        if (BUS_ERROR(ec) && nb_bus_decoder)
                nb_bus_decoder(node_id, regs);
@@ -374,7 +373,7 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val,
                 ((m->status & MCI_STATUS_PCC) ? "yes" : "no"));
 
        /* do the two bits[14:13] together */
-       ecc = m->status & (3ULL << 45);
+       ecc = (m->status >> 45) & 0x3;
        if (ecc)
                pr_cont(", %sECC Error", ((ecc == 2) ? "C" : "U"));
 
index 76be229..eb0c3fe 100644 (file)
@@ -416,7 +416,8 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
        return 0;
 
 free_sd:
-       sysfs_put(pdesc->value_sd);
+       if (pdesc)
+               sysfs_put(pdesc->value_sd);
 free_id:
        idr_remove(&pdesc_idr, id);
        desc->flags &= GPIO_FLAGS_MASK;
index 18ecae4..b474833 100644 (file)
@@ -69,7 +69,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
                }
 
                phy = get_phy_device(mdio, be32_to_cpup(addr));
-               if (!phy) {
+               if (!phy || IS_ERR(phy)) {
                        dev_err(&mdio->dev, "error probing PHY at address %i\n",
                                *addr);
                        continue;
index 3119fdd..a176ab4 100644 (file)
  * kind, whether express or implied.
  */
 
-/* Platform device Usage :
- *
- * Since PSCs can have multiple function, the correct driver for each one
- * is selected by calling mpc52xx_match_psc_function(...). The function
- * handled by this driver is "uart".
- *
- * The driver init all necessary registers to place the PSC in uart mode without
- * DCD. However, the pin multiplexing aren't changed and should be set either
- * by the bootloader or in the platform init code.
- *
- * The idx field must be equal to the PSC index (e.g. 0 for PSC1, 1 for PSC2,
- * and so on). So the PSC1 is mapped to /dev/ttyPSC0, PSC2 to /dev/ttyPSC1 and
- * so on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly
- * fpr the console code : without this 1:1 mapping, at early boot time, when we
- * are parsing the kernel args console=ttyPSC?, we wouldn't know which PSC it
- * will be mapped to.
- */
-
-/* OF Platform device Usage :
- *
- * This driver is only used for PSCs configured in uart mode.  The device
- * tree will have a node for each PSC with "mpc52xx-psc-uart" in the compatible
- * list.
- *
- * By default, PSC devices are enumerated in the order they are found.  However
- * a particular PSC number can be forces by adding 'device_no = <port#>'
- * to the device node.
- *
- * The driver init all necessary registers to place the PSC in uart mode without
- * DCD. However, the pin multiplexing aren't changed and should be set either
- * by the bootloader or in the platform init code.
- */
-
 #undef DEBUG
 
 #include <linux/device.h>
index d8356af..e0de0d0 100644 (file)
@@ -204,6 +204,7 @@ static inline void mcspi_write_chconf0(const struct spi_device *spi, u32 val)
 
        cs->chconf0 = val;
        mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val);
+       mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCONF0);
 }
 
 static void omap2_mcspi_set_dma_req(const struct spi_device *spi,
@@ -532,7 +533,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
                                        goto out;
                                }
 #ifdef VERBOSE
-                               dev_dbg(&spi->dev, "write-%d %04x\n",
+                               dev_dbg(&spi->dev, "write-%d %08x\n",
                                                word_len, *tx);
 #endif
                                __raw_writel(*tx++, tx_reg);
@@ -550,7 +551,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
                                        mcspi_write_chconf0(spi, l);
                                *rx++ = __raw_readl(rx_reg);
 #ifdef VERBOSE
-                               dev_dbg(&spi->dev, "read-%d %04x\n",
+                               dev_dbg(&spi->dev, "read-%d %08x\n",
                                                word_len, *(rx - 1));
 #endif
                        }
index 9ffb0fd..b3a1f92 100644 (file)
@@ -41,7 +41,7 @@ static void spidev_release(struct device *dev)
                spi->master->cleanup(spi);
 
        spi_master_put(spi->master);
-       kfree(dev);
+       kfree(spi);
 }
 
 static ssize_t
@@ -257,6 +257,7 @@ int spi_add_device(struct spi_device *spi)
 {
        static DEFINE_MUTEX(spi_add_lock);
        struct device *dev = spi->master->dev.parent;
+       struct device *d;
        int status;
 
        /* Chipselects are numbered 0..max; validate. */
@@ -278,10 +279,11 @@ int spi_add_device(struct spi_device *spi)
         */
        mutex_lock(&spi_add_lock);
 
-       if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev))
-                       != NULL) {
+       d = bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev));
+       if (d != NULL) {
                dev_err(dev, "chipselect %d already in use\n",
                                spi->chip_select);
+               put_device(d);
                status = -EBUSY;
                goto done;
        }
index be6331e..5e1a253 100644 (file)
@@ -1542,6 +1542,9 @@ static const struct usb_device_id acm_ids[] = {
        { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
        .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
        },
+       { USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */
+       .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
+       },
 
        /* Nokia S60 phones expose two ACM channels. The first is
         * a modem and is picked up by the standard AT-command
index 97a819c..7e59444 100644 (file)
@@ -109,7 +109,7 @@ config USB_SUSPEND
 config USB_OTG
        bool
        depends on USB && EXPERIMENTAL
-       select USB_SUSPEND
+       depends on USB_SUSPEND
        default n
 
 
index bdf87a8..2c95153 100644 (file)
@@ -120,7 +120,7 @@ int usb_choose_configuration(struct usb_device *udev)
                 * than a vendor-specific driver. */
                else if (udev->descriptor.bDeviceClass !=
                                                USB_CLASS_VENDOR_SPEC &&
-                               (!desc || desc->bInterfaceClass !=
+                               (desc && desc->bInterfaceClass !=
                                                USB_CLASS_VENDOR_SPEC)) {
                        best = c;
                        break;
index 97b40ce..4a6366a 100644 (file)
@@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
        *dentry = NULL;
        mutex_lock(&parent->d_inode->i_mutex);
        *dentry = lookup_one_len(name, parent, strlen(name));
-       if (!IS_ERR(dentry)) {
+       if (!IS_ERR(*dentry)) {
                if ((mode & S_IFMT) == S_IFDIR)
                        error = usbfs_mkdir (parent->d_inode, *dentry, mode);
                else 
                        error = usbfs_create (parent->d_inode, *dentry, mode);
        } else
-               error = PTR_ERR(dentry);
+               error = PTR_ERR(*dentry);
        mutex_unlock(&parent->d_inode->i_mutex);
 
        return error;
index 1297e9b..0561430 100644 (file)
@@ -718,7 +718,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
 EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
 
 /**
- * usb_buffer_alloc - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
+ * usb_alloc_coherent - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
  * @dev: device the buffer will be used with
  * @size: requested buffer size
  * @mem_flags: affect whether allocation may block
@@ -737,30 +737,30 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
  * architectures where CPU caches are not DMA-coherent.  On systems without
  * bus-snooping caches, these buffers are uncached.
  *
- * When the buffer is no longer used, free it with usb_buffer_free().
+ * When the buffer is no longer used, free it with usb_free_coherent().
  */
-void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags,
-                      dma_addr_t *dma)
+void *usb_alloc_coherent(struct usb_device *dev, size_t size, gfp_t mem_flags,
+                        dma_addr_t *dma)
 {
        if (!dev || !dev->bus)
                return NULL;
        return hcd_buffer_alloc(dev->bus, size, mem_flags, dma);
 }
-EXPORT_SYMBOL_GPL(usb_buffer_alloc);
+EXPORT_SYMBOL_GPL(usb_alloc_coherent);
 
 /**
- * usb_buffer_free - free memory allocated with usb_buffer_alloc()
+ * usb_free_coherent - free memory allocated with usb_alloc_coherent()
  * @dev: device the buffer was used with
  * @size: requested buffer size
  * @addr: CPU address of buffer
  * @dma: DMA address of buffer
  *
  * This reclaims an I/O buffer, letting it be reused.  The memory must have
- * been allocated using usb_buffer_alloc(), and the parameters must match
+ * been allocated using usb_alloc_coherent(), and the parameters must match
  * those provided in that allocation request.
  */
-void usb_buffer_free(struct usb_device *dev, size_t size, void *addr,
-                    dma_addr_t dma)
+void usb_free_coherent(struct usb_device *dev, size_t size, void *addr,
+                      dma_addr_t dma)
 {
        if (!dev || !dev->bus)
                return;
@@ -768,7 +768,7 @@ void usb_buffer_free(struct usb_device *dev, size_t size, void *addr,
                return;
        hcd_buffer_free(dev->bus, size, addr, dma);
 }
-EXPORT_SYMBOL_GPL(usb_buffer_free);
+EXPORT_SYMBOL_GPL(usb_free_coherent);
 
 /**
  * usb_buffer_map - create DMA mapping(s) for an urb
index 124a8cc..1f73b48 100644 (file)
@@ -2145,6 +2145,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
        u32 epctrl;
        u32 mps;
        int dir_in;
+       int ret = 0;
 
        dev_dbg(hsotg->dev,
                "%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n",
@@ -2196,7 +2197,8 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
        switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
        case USB_ENDPOINT_XFER_ISOC:
                dev_err(hsotg->dev, "no current ISOC support\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out;
 
        case USB_ENDPOINT_XFER_BULK:
                epctrl |= S3C_DxEPCTL_EPType_Bulk;
@@ -2235,8 +2237,9 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
        /* enable the endpoint interrupt */
        s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
 
+out:
        spin_unlock_irqrestore(&hs_ep->lock, flags);
-       return 0;
+       return ret;
 }
 
 static int s3c_hsotg_ep_disable(struct usb_ep *ep)
index 68b83ab..944291e 100644 (file)
@@ -331,6 +331,8 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
         */
        if (at91_suspend_entering_slow_clock()) {
                ohci_usb_reset (ohci);
+               /* flush the writes */
+               (void) ohci_readl (ohci, &ohci->regs->control);
                at91_stop_clock();
        }
 
index 32bbce9..65cac8c 100644 (file)
@@ -697,7 +697,7 @@ static int ohci_hub_control (
        u16             wLength
 ) {
        struct ohci_hcd *ohci = hcd_to_ohci (hcd);
-       int             ports = hcd_to_bus (hcd)->root_hub->maxchild;
+       int             ports = ohci->num_ports;
        u32             temp;
        int             retval = 0;
 
index 50f57f4..e62b30b 100644 (file)
@@ -660,13 +660,13 @@ static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu)
                if (qh->dummy == NULL) {
                        oxu_dbg(oxu, "no dummy td\n");
                        oxu->qh_used[i] = 0;
-
-                       return NULL;
+                       qh = NULL;
+                       goto unlock;
                }
 
                oxu->qh_used[i] = 1;
        }
-
+unlock:
        spin_unlock(&oxu->mem_lock);
 
        return qh;
index e11cc3a..3b867a8 100644 (file)
@@ -720,10 +720,10 @@ retry:
                /* port status seems weird until after reset, so
                 * force the reset and make khubd clean up later.
                 */
-               if (sl811->stat_insrmv & 1)
-                       sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;
-               else
+               if (irqstat & SL11H_INTMASK_RD)
                        sl811->port1 &= ~(1 << USB_PORT_FEAT_CONNECTION);
+               else
+                       sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;
 
                sl811->port1 |= 1 << USB_PORT_FEAT_C_CONNECTION;
 
index c09539b..d64f572 100644 (file)
@@ -582,6 +582,19 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
        return EP_INTERVAL(interval);
 }
 
+/* The "Mult" field in the endpoint context is only set for SuperSpeed devices.
+ * High speed endpoint descriptors can define "the number of additional
+ * transaction opportunities per microframe", but that goes in the Max Burst
+ * endpoint context field.
+ */
+static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
+               struct usb_host_endpoint *ep)
+{
+       if (udev->speed != USB_SPEED_SUPER || !ep->ss_ep_comp)
+               return 0;
+       return ep->ss_ep_comp->desc.bmAttributes;
+}
+
 static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
                struct usb_host_endpoint *ep)
 {
@@ -612,6 +625,36 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
        return type;
 }
 
+/* Return the maximum endpoint service interval time (ESIT) payload.
+ * Basically, this is the maxpacket size, multiplied by the burst size
+ * and mult size.
+ */
+static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
+               struct usb_device *udev,
+               struct usb_host_endpoint *ep)
+{
+       int max_burst;
+       int max_packet;
+
+       /* Only applies for interrupt or isochronous endpoints */
+       if (usb_endpoint_xfer_control(&ep->desc) ||
+                       usb_endpoint_xfer_bulk(&ep->desc))
+               return 0;
+
+       if (udev->speed == USB_SPEED_SUPER) {
+               if (ep->ss_ep_comp)
+                       return ep->ss_ep_comp->desc.wBytesPerInterval;
+               xhci_warn(xhci, "WARN no SS endpoint companion descriptor.\n");
+               /* Assume no bursts, no multiple opportunities to send. */
+               return ep->desc.wMaxPacketSize;
+       }
+
+       max_packet = ep->desc.wMaxPacketSize & 0x3ff;
+       max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
+       /* A 0 in max burst means 1 transfer per ESIT */
+       return max_packet * (max_burst + 1);
+}
+
 int xhci_endpoint_init(struct xhci_hcd *xhci,
                struct xhci_virt_device *virt_dev,
                struct usb_device *udev,
@@ -623,6 +666,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
        struct xhci_ring *ep_ring;
        unsigned int max_packet;
        unsigned int max_burst;
+       u32 max_esit_payload;
 
        ep_index = xhci_get_endpoint_index(&ep->desc);
        ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
@@ -644,6 +688,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
        ep_ctx->deq = ep_ring->first_seg->dma | ep_ring->cycle_state;
 
        ep_ctx->ep_info = xhci_get_endpoint_interval(udev, ep);
+       ep_ctx->ep_info |= EP_MULT(xhci_get_endpoint_mult(udev, ep));
 
        /* FIXME dig Mult and streams info out of ep companion desc */
 
@@ -689,6 +734,26 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
        default:
                BUG();
        }
+       max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
+       ep_ctx->tx_info = MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload);
+
+       /*
+        * XXX no idea how to calculate the average TRB buffer length for bulk
+        * endpoints, as the driver gives us no clue how big each scatter gather
+        * list entry (or buffer) is going to be.
+        *
+        * For isochronous and interrupt endpoints, we set it to the max
+        * available, until we have new API in the USB core to allow drivers to
+        * declare how much bandwidth they actually need.
+        *
+        * Normally, it would be calculated by taking the total of the buffer
+        * lengths in the TD and then dividing by the number of TRBs in a TD,
+        * including link TRBs, No-op TRBs, and Event data TRBs.  Since we don't
+        * use Event Data TRBs, and we don't chain in a link TRB on short
+        * transfers, we're basically dividing by 1.
+        */
+       ep_ctx->tx_info |= AVG_TRB_LENGTH_FOR_EP(max_esit_payload);
+
        /* FIXME Debug endpoint context */
        return 0;
 }
index e5eb09b..ea389e9 100644 (file)
@@ -609,6 +609,10 @@ struct xhci_ep_ctx {
 #define MAX_PACKET_MASK                (0xffff << 16)
 #define MAX_PACKET_DECODED(p)  (((p) >> 16) & 0xffff)
 
+/* tx_info bitmasks */
+#define AVG_TRB_LENGTH_FOR_EP(p)       ((p) & 0xffff)
+#define MAX_ESIT_PAYLOAD_FOR_EP(p)     (((p) & 0xffff) << 16)
+
 
 /**
  * struct xhci_input_control_context
index b4c783c..07fe490 100644 (file)
@@ -42,7 +42,7 @@ config USB_MUSB_SOC
        default y if (BF52x && !BF522 && !BF523)
 
 comment "DaVinci 35x and 644x USB support"
-       depends on USB_MUSB_HDRC && ARCH_DAVINCI
+       depends on USB_MUSB_HDRC && ARCH_DAVINCI_DMx
 
 comment "OMAP 243x high speed USB support"
        depends on USB_MUSB_HDRC && ARCH_OMAP2430
index 85710cc..3a485da 100644 (file)
@@ -6,7 +6,7 @@ musb_hdrc-objs := musb_core.o
 
 obj-$(CONFIG_USB_MUSB_HDRC)    += musb_hdrc.o
 
-ifeq ($(CONFIG_ARCH_DAVINCI),y)
+ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y)
        musb_hdrc-objs  += davinci.o
 endif
 
index 719a22d..ec8d324 100644 (file)
@@ -172,13 +172,7 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
 
        spin_unlock_irqrestore(&musb->lock, flags);
 
-       /* REVISIT we sometimes get spurious IRQs on g_ep0
-        * not clear why... fall in BF54x too.
-        */
-       if (retval != IRQ_HANDLED)
-               DBG(5, "spurious?\n");
-
-       return IRQ_HANDLED;
+       return retval;
 }
 
 static void musb_conn_timer_handler(unsigned long _musb)
index 29bce5c..ce2e16f 100644 (file)
@@ -444,6 +444,8 @@ int __init musb_platform_init(struct musb *musb)
        return 0;
 
 fail:
+       clk_disable(musb->clock);
+
        usb_nop_xceiv_unregister();
        return -ENODEV;
 }
index 0e8b8ab..705cc4a 100644 (file)
@@ -965,10 +965,8 @@ static void musb_shutdown(struct platform_device *pdev)
        spin_lock_irqsave(&musb->lock, flags);
        musb_platform_disable(musb);
        musb_generic_disable(musb);
-       if (musb->clock) {
+       if (musb->clock)
                clk_put(musb->clock);
-               musb->clock = NULL;
-       }
        spin_unlock_irqrestore(&musb->lock, flags);
 
        /* FIXME power down */
@@ -1853,15 +1851,6 @@ static void musb_free(struct musb *musb)
        put_device(musb->xceiv->dev);
 #endif
 
-       musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
-       musb_platform_exit(musb);
-       musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
-
-       if (musb->clock) {
-               clk_disable(musb->clock);
-               clk_put(musb->clock);
-       }
-
 #ifdef CONFIG_USB_MUSB_HDRC_HCD
        usb_put_hcd(musb_to_hcd(musb));
 #else
@@ -1889,8 +1878,10 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
         */
        if (!plat) {
                dev_dbg(dev, "no platform_data?\n");
-               return -ENODEV;
+               status = -ENODEV;
+               goto fail0;
        }
+
        switch (plat->mode) {
        case MUSB_HOST:
 #ifdef CONFIG_USB_MUSB_HDRC_HCD
@@ -1912,13 +1903,16 @@ bad_config:
 #endif
        default:
                dev_err(dev, "incompatible Kconfig role setting\n");
-               return -EINVAL;
+               status = -EINVAL;
+               goto fail0;
        }
 
        /* allocate */
        musb = allocate_instance(dev, plat->config, ctrl);
-       if (!musb)
-               return -ENOMEM;
+       if (!musb) {
+               status = -ENOMEM;
+               goto fail0;
+       }
 
        spin_lock_init(&musb->lock);
        musb->board_mode = plat->mode;
@@ -1936,7 +1930,7 @@ bad_config:
                if (IS_ERR(musb->clock)) {
                        status = PTR_ERR(musb->clock);
                        musb->clock = NULL;
-                       goto fail;
+                       goto fail1;
                }
        }
 
@@ -1955,12 +1949,12 @@ bad_config:
         */
        musb->isr = generic_interrupt;
        status = musb_platform_init(musb);
-
        if (status < 0)
-               goto fail;
+               goto fail2;
+
        if (!musb->isr) {
                status = -ENODEV;
-               goto fail2;
+               goto fail3;
        }
 
 #ifndef CONFIG_MUSB_PIO_ONLY
@@ -1986,7 +1980,7 @@ bad_config:
                        ? MUSB_CONTROLLER_MHDRC
                        : MUSB_CONTROLLER_HDRC, musb);
        if (status < 0)
-               goto fail2;
+               goto fail3;
 
 #ifdef CONFIG_USB_MUSB_OTG
        setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb);
@@ -1999,7 +1993,7 @@ bad_config:
        if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
                dev_err(dev, "request_irq %d failed!\n", nIrq);
                status = -ENODEV;
-               goto fail2;
+               goto fail3;
        }
        musb->nIrq = nIrq;
 /* FIXME this handles wakeup irqs wrong */
@@ -2039,8 +2033,6 @@ bad_config:
                musb->xceiv->state = OTG_STATE_A_IDLE;
 
                status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
-               if (status)
-                       goto fail;
 
                DBG(1, "%s mode, status %d, devctl %02x %c\n",
                        "HOST", status,
@@ -2055,8 +2047,6 @@ bad_config:
                musb->xceiv->state = OTG_STATE_B_IDLE;
 
                status = musb_gadget_setup(musb);
-               if (status)
-                       goto fail;
 
                DBG(1, "%s mode, status %d, dev%02x\n",
                        is_otg_enabled(musb) ? "OTG" : "PERIPHERAL",
@@ -2064,12 +2054,14 @@ bad_config:
                        musb_readb(musb->mregs, MUSB_DEVCTL));
 
        }
+       if (status < 0)
+               goto fail3;
 
 #ifdef CONFIG_SYSFS
        status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
-#endif
        if (status)
-               goto fail2;
+               goto fail4;
+#endif
 
        dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
                        ({char *s;
@@ -2085,17 +2077,29 @@ bad_config:
 
        return 0;
 
-fail2:
+fail4:
+       if (!is_otg_enabled(musb) && is_host_enabled(musb))
+               usb_remove_hcd(musb_to_hcd(musb));
+       else
+               musb_gadget_cleanup(musb);
+
+fail3:
+       if (musb->irq_wake)
+               device_init_wakeup(dev, 0);
        musb_platform_exit(musb);
-fail:
-       dev_err(musb->controller,
-               "musb_init_controller failed with status %d\n", status);
 
+fail2:
        if (musb->clock)
                clk_put(musb->clock);
-       device_init_wakeup(dev, 0);
+
+fail1:
+       dev_err(musb->controller,
+               "musb_init_controller failed with status %d\n", status);
+
        musb_free(musb);
 
+fail0:
+
        return status;
 
 }
@@ -2132,7 +2136,6 @@ static int __init musb_probe(struct platform_device *pdev)
        /* clobbered by use_dma=n */
        orig_dma_mask = dev->dma_mask;
 #endif
-
        status = musb_init_controller(dev, irq, base);
        if (status < 0)
                iounmap(base);
@@ -2155,6 +2158,10 @@ static int __exit musb_remove(struct platform_device *pdev)
        if (musb->board_mode == MUSB_HOST)
                usb_remove_hcd(musb_to_hcd(musb));
 #endif
+       musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+       musb_platform_exit(musb);
+       musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+
        musb_free(musb);
        iounmap(ctrl_base);
        device_init_wakeup(&pdev->dev, 0);
@@ -2176,6 +2183,7 @@ void musb_save_context(struct musb *musb)
        if (is_host_enabled(musb)) {
                musb_context.frame = musb_readw(musb_base, MUSB_FRAME);
                musb_context.testmode = musb_readb(musb_base, MUSB_TESTMODE);
+               musb_context.busctl = musb_read_ulpi_buscontrol(musb->mregs);
        }
        musb_context.power = musb_readb(musb_base, MUSB_POWER);
        musb_context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE);
@@ -2247,6 +2255,7 @@ void musb_restore_context(struct musb *musb)
        if (is_host_enabled(musb)) {
                musb_writew(musb_base, MUSB_FRAME, musb_context.frame);
                musb_writeb(musb_base, MUSB_TESTMODE, musb_context.testmode);
+               musb_write_ulpi_buscontrol(musb->mregs, musb_context.busctl);
        }
        musb_writeb(musb_base, MUSB_POWER, musb_context.power);
        musb_writew(musb_base, MUSB_INTRTXE, musb_context.intrtxe);
index cd9f4a9..ac17b00 100644 (file)
@@ -478,7 +478,7 @@ struct musb_context_registers {
        u16 frame;
        u8 index, testmode;
 
-       u8 devctl, misc;
+       u8 devctl, busctl, misc;
 
        struct musb_csr_regs index_regs[MUSB_C_NUM_EPS];
 };
index dec896e..877d20b 100644 (file)
@@ -2042,6 +2042,7 @@ static int musb_urb_enqueue(
                 * odd, rare, error prone, but legal.
                 */
                kfree(qh);
+               qh = NULL;
                ret = 0;
        } else
                ret = musb_schedule(musb, qh,
index 490cdf1..8259263 100644 (file)
@@ -331,8 +331,5 @@ int musb_platform_exit(struct musb *musb)
 
        musb_platform_suspend(musb);
 
-       clk_put(musb->clock);
-       musb->clock = NULL;
-
        return 0;
 }
index ab776a8..60d3938 100644 (file)
@@ -29,6 +29,19 @@ static void tusb_source_power(struct musb *musb, int is_on);
 #define TUSB_REV_MAJOR(reg_val)                ((reg_val >> 4) & 0xf)
 #define TUSB_REV_MINOR(reg_val)                (reg_val & 0xf)
 
+#ifdef CONFIG_PM
+/* REVISIT: These should be only needed if somebody implements off idle */
+void musb_platform_save_context(struct musb *musb,
+                       struct musb_context_registers *musb_context)
+{
+}
+
+void musb_platform_restore_context(struct musb *musb,
+                       struct musb_context_registers *musb_context)
+{
+}
+#endif
+
 /*
  * Checks the revision. We need to use the DMA register as 3.0 does not
  * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV.
index 5afa070..c061a88 100644 (file)
@@ -39,7 +39,7 @@ struct tusb_omap_dma_ch {
 
        struct tusb_omap_dma    *tusb_dma;
 
-       void __iomem            *dma_addr;
+       dma_addr_t              dma_addr;
 
        u32                     len;
        u16                     packet_sz;
@@ -126,6 +126,7 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data)
        struct tusb_omap_dma_ch *chdat = to_chdat(channel);
        struct tusb_omap_dma    *tusb_dma = chdat->tusb_dma;
        struct musb             *musb = chdat->musb;
+       struct device           *dev = musb->controller;
        struct musb_hw_ep       *hw_ep = chdat->hw_ep;
        void __iomem            *ep_conf = hw_ep->conf;
        void __iomem            *mbase = musb->mregs;
@@ -173,13 +174,15 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data)
                DBG(3, "Using PIO for remaining %lu bytes\n", pio);
                buf = phys_to_virt((u32)chdat->dma_addr) + chdat->transfer_len;
                if (chdat->tx) {
-                       dma_cache_maint(phys_to_virt((u32)chdat->dma_addr),
-                                       chdat->transfer_len, DMA_TO_DEVICE);
+                       dma_unmap_single(dev, chdat->dma_addr,
+                                               chdat->transfer_len,
+                                               DMA_TO_DEVICE);
                        musb_write_fifo(hw_ep, pio, buf);
                } else {
+                       dma_unmap_single(dev, chdat->dma_addr,
+                                               chdat->transfer_len,
+                                               DMA_FROM_DEVICE);
                        musb_read_fifo(hw_ep, pio, buf);
-                       dma_cache_maint(phys_to_virt((u32)chdat->dma_addr),
-                                       chdat->transfer_len, DMA_FROM_DEVICE);
                }
                channel->actual_len += pio;
        }
@@ -224,6 +227,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
        struct tusb_omap_dma_ch         *chdat = to_chdat(channel);
        struct tusb_omap_dma            *tusb_dma = chdat->tusb_dma;
        struct musb                     *musb = chdat->musb;
+       struct device                   *dev = musb->controller;
        struct musb_hw_ep               *hw_ep = chdat->hw_ep;
        void __iomem                    *mbase = musb->mregs;
        void __iomem                    *ep_conf = hw_ep->conf;
@@ -299,14 +303,16 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
        chdat->packet_sz = packet_sz;
        chdat->len = len;
        channel->actual_len = 0;
-       chdat->dma_addr = (void __iomem *)dma_addr;
+       chdat->dma_addr = dma_addr;
        channel->status = MUSB_DMA_STATUS_BUSY;
 
        /* Since we're recycling dma areas, we need to clean or invalidate */
        if (chdat->tx)
-               dma_cache_maint(phys_to_virt(dma_addr), len, DMA_TO_DEVICE);
+               dma_map_single(dev, phys_to_virt(dma_addr), len,
+                               DMA_TO_DEVICE);
        else
-               dma_cache_maint(phys_to_virt(dma_addr), len, DMA_FROM_DEVICE);
+               dma_map_single(dev, phys_to_virt(dma_addr), len,
+                               DMA_FROM_DEVICE);
 
        /* Use 16-bit transfer if dma_addr is not 32-bit aligned */
        if ((dma_addr & 0x3) == 0) {
index ca9d866..84d0eda 100644 (file)
@@ -305,6 +305,11 @@ static int  option_resume(struct usb_serial *serial);
 #define ZTE_PRODUCT_CDMA_TECH                  0xfffe
 #define ZTE_PRODUCT_AC8710                     0xfff1
 #define ZTE_PRODUCT_AC2726                     0xfff5
+#define ZTE_PRODUCT_AC8710T                    0xffff
+
+/* ZTE PRODUCTS -- alternate vendor ID */
+#define ZTE_VENDOR_ID2                         0x1d6b
+#define ZTE_PRODUCT_MF_330                     0x0002
 
 #define BENQ_VENDOR_ID                         0x04a5
 #define BENQ_PRODUCT_H10                       0x4068
@@ -373,6 +378,8 @@ static int  option_resume(struct usb_serial *serial);
 #define HAIER_VENDOR_ID                                0x201e
 #define HAIER_PRODUCT_CE100                    0x2009
 
+#define CINTERION_VENDOR_ID                    0x0681
+
 /* some devices interfaces need special handling due to a number of reasons */
 enum option_blacklist_reason {
                OPTION_BLACKLIST_NONE = 0,
@@ -679,6 +686,8 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
        { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
        { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
+       { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
+       { USB_DEVICE(ZTE_VENDOR_ID2, ZTE_PRODUCT_MF_330) },
        { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
        { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
        { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
@@ -716,6 +725,7 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
        { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
 
+       { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) },
        { } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
index c97a0bb..c28b160 100644 (file)
@@ -59,6 +59,7 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) },
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) },
+       { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) },
        { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
        { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
        { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
index a352d5f..23c09b3 100644 (file)
@@ -20,6 +20,7 @@
 #define PL2303_PRODUCT_ID_ALDIGA       0x0611
 #define PL2303_PRODUCT_ID_MMX          0x0612
 #define PL2303_PRODUCT_ID_GPRS         0x0609
+#define PL2303_PRODUCT_ID_HCR331       0x331a
 
 #define ATEN_VENDOR_ID         0x0557
 #define ATEN_VENDOR_ID2                0x0547
index 880e990..e1bfda3 100644 (file)
@@ -1735,7 +1735,7 @@ static int ti_download_firmware(struct ti_device *tdev)
                return -ENOENT;
        }
        if (fw_p->size > TI_FIRMWARE_BUF_SIZE) {
-               dev_err(&dev->dev, "%s - firmware too large %\n", __func__, fw_p->size);
+               dev_err(&dev->dev, "%s - firmware too large %zu\n", __func__, fw_p->size);
                return -ENOENT;
        }
 
index 3e56dbf..b3a159b 100644 (file)
@@ -15,6 +15,7 @@ config INOTIFY
 
 config INOTIFY_USER
        bool "Inotify support for userspace"
+       select ANON_INODES
        select FSNOTIFY
        default y
        ---help---
index ce1323c..739f1fd 100644 (file)
@@ -1085,7 +1085,7 @@ typedef void (*usb_complete_t)(struct urb *);
  * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags,
  * which tell the host controller driver that no such mapping is needed since
  * the device driver is DMA-aware.  For example, a device driver might
- * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map().
+ * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map().
  * When these transfer flags are provided, host controller drivers will
  * attempt to use the dma addresses found in the transfer_dma and/or
  * setup_dma fields rather than determining a dma address themselves.
@@ -1366,11 +1366,23 @@ static inline int usb_urb_dir_out(struct urb *urb)
        return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
 }
 
-void *usb_buffer_alloc(struct usb_device *dev, size_t size,
+void *usb_alloc_coherent(struct usb_device *dev, size_t size,
        gfp_t mem_flags, dma_addr_t *dma);
-void usb_buffer_free(struct usb_device *dev, size_t size,
+void usb_free_coherent(struct usb_device *dev, size_t size,
        void *addr, dma_addr_t dma);
 
+/* Compatible macros while we switch over */
+static inline void *usb_buffer_alloc(struct usb_device *dev, size_t size,
+                                    gfp_t mem_flags, dma_addr_t *dma)
+{
+       return usb_alloc_coherent(dev, size, mem_flags, dma);
+}
+static inline void usb_buffer_free(struct usb_device *dev, size_t size,
+                                  void *addr, dma_addr_t dma)
+{
+       return usb_free_coherent(dev, size, addr, dma);
+}
+
 #if 0
 struct urb *usb_buffer_map(struct urb *urb);
 void usb_buffer_dmasync(struct urb *urb);