Revert "USB: sam-ba: add driver for Atmel SAM Boot Assistant (SAM-BA)"
authorJohan Hovold <jhovold@gmail.com>
Mon, 4 Apr 2011 09:38:07 +0000 (11:38 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 13 Apr 2011 23:48:25 +0000 (16:48 -0700)
This reverts commit 90593899de83a6e6fdea563d058acd2f4334e3f9.

SAM-BA devices identify themselves CDC-ACM devices and should be using
the cdc-acm driver.

Since commit 5b239f0aebd4dd6f85b13decf5e18e86e35d57f0 (USB: cdc-acm: Add pseudo
modem without AT command capabilities) cdc-acm also binds to them.

Note that the Atmel SAM-BA tools expect to use a USB-serial driver and thus
require a symlink from /dev/ttyACMn to some /dev/ttyUSBm (with m < 30) to be
able to select the device. This is simply a UI-issue that should be
fixed by Atmel.

Tested with the SAM-BA 2.10 tools and an Atmel at91sam9260-ek.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Cc: Sven Köhler <sven.koehler@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/Kconfig
drivers/usb/serial/Makefile
drivers/usb/serial/sam-ba.c [deleted file]

index c2b29761fa98e3bc6646943e0dbf9a9076c7e8e3..b71e309116a304c37ea462762ab5bdb89a240185 100644 (file)
@@ -527,15 +527,6 @@ config USB_SERIAL_SAFE_PADDED
        bool "USB Secure Encapsulated Driver - Padded"
        depends on USB_SERIAL_SAFE
 
-config USB_SERIAL_SAMBA
-       tristate "USB Atmel SAM Boot Assistant (SAM-BA) driver"
-       help
-         Say Y here if you want to access the SAM-BA boot application of an
-         Atmel AT91SAM device.
-
-         To compile this driver as a module, choose M here: the
-         module will be called sam-ba.
-
 config USB_SERIAL_SIEMENS_MPI
        tristate "USB Siemens MPI driver"
        help
index 9a2117f2b06e88ec9115ded1d0c20bd1a67c2b13..9e536eefb32c32e96d45a993a919b97d865a1bfa 100644 (file)
@@ -48,7 +48,6 @@ obj-$(CONFIG_USB_SERIAL_PL2303)                       += pl2303.o
 obj-$(CONFIG_USB_SERIAL_QCAUX)                 += qcaux.o
 obj-$(CONFIG_USB_SERIAL_QUALCOMM)              += qcserial.o
 obj-$(CONFIG_USB_SERIAL_SAFE)                  += safe_serial.o
-obj-$(CONFIG_USB_SERIAL_SAMBA)                 += sam-ba.o
 obj-$(CONFIG_USB_SERIAL_SIEMENS_MPI)           += siemens_mpi.o
 obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS)                += sierra.o
 obj-$(CONFIG_USB_SERIAL_SPCP8X5)               += spcp8x5.o
diff --git a/drivers/usb/serial/sam-ba.c b/drivers/usb/serial/sam-ba.c
deleted file mode 100644 (file)
index e3bba64..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Atmel SAM Boot Assistant (SAM-BA) driver
- *
- * Copyright (C) 2010 Johan Hovold <jhovold@gmail.com>
- *
- *     This program is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License version
- *     2 as published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/tty.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/usb.h>
-#include <linux/usb/serial.h>
-
-
-#define DRIVER_VERSION "v1.0"
-#define DRIVER_AUTHOR  "Johan Hovold <jhovold@gmail.com>"
-#define DRIVER_DESC    "Atmel SAM Boot Assistant (SAM-BA) driver"
-
-#define SAMBA_VENDOR_ID                0x3eb
-#define SAMBA_PRODUCT_ID       0x6124
-
-
-static int debug;
-
-static const struct usb_device_id id_table[] = {
-       /*
-        * NOTE: Only match the CDC Data interface.
-        */
-       { USB_DEVICE_AND_INTERFACE_INFO(SAMBA_VENDOR_ID, SAMBA_PRODUCT_ID,
-                                       USB_CLASS_CDC_DATA, 0, 0) },
-       { }
-};
-MODULE_DEVICE_TABLE(usb, id_table);
-
-static struct usb_driver samba_driver = {
-       .name           = "sam-ba",
-       .probe          = usb_serial_probe,
-       .disconnect     = usb_serial_disconnect,
-       .id_table       = id_table,
-       .no_dynamic_id  = 1,
-};
-
-
-/*
- * NOTE: The SAM-BA firmware cannot handle merged write requests so we cannot
- *       use the generic write implementation (which uses the port write fifo).
- */
-static int samba_write(struct tty_struct *tty, struct usb_serial_port *port,
-                                       const unsigned char *buf, int count)
-{
-       struct urb *urb;
-       unsigned long flags;
-       int result;
-       int i;
-
-       if (!count)
-               return 0;
-
-       count = min_t(int, count, port->bulk_out_size);
-
-       spin_lock_irqsave(&port->lock, flags);
-       if (!port->write_urbs_free) {
-               spin_unlock_irqrestore(&port->lock, flags);
-               return 0;
-       }
-       i = find_first_bit(&port->write_urbs_free,
-                                               ARRAY_SIZE(port->write_urbs));
-       __clear_bit(i, &port->write_urbs_free);
-       port->tx_bytes += count;
-       spin_unlock_irqrestore(&port->lock, flags);
-
-       urb = port->write_urbs[i];
-       memcpy(urb->transfer_buffer, buf, count);
-       urb->transfer_buffer_length = count;
-       usb_serial_debug_data(debug, &port->dev, __func__, count,
-                                               urb->transfer_buffer);
-       result = usb_submit_urb(urb, GFP_ATOMIC);
-       if (result) {
-               dev_err(&port->dev, "%s - error submitting urb: %d\n",
-                                               __func__, result);
-               spin_lock_irqsave(&port->lock, flags);
-               __set_bit(i, &port->write_urbs_free);
-               port->tx_bytes -= count;
-               spin_unlock_irqrestore(&port->lock, flags);
-
-               return result;
-       }
-
-       return count;
-}
-
-static int samba_write_room(struct tty_struct *tty)
-{
-       struct usb_serial_port *port = tty->driver_data;
-       unsigned long flags;
-       unsigned long free;
-       int count;
-       int room;
-
-       spin_lock_irqsave(&port->lock, flags);
-       free = port->write_urbs_free;
-       spin_unlock_irqrestore(&port->lock, flags);
-
-       count = hweight_long(free);
-       room = count * port->bulk_out_size;
-
-       dbg("%s - returns %d", __func__, room);
-
-       return room;
-}
-
-static int samba_chars_in_buffer(struct tty_struct *tty)
-{
-       struct usb_serial_port *port = tty->driver_data;
-       unsigned long flags;
-       int chars;
-
-       spin_lock_irqsave(&port->lock, flags);
-       chars = port->tx_bytes;
-       spin_unlock_irqrestore(&port->lock, flags);
-
-       dbg("%s - returns %d", __func__, chars);
-
-       return chars;
-}
-
-static void samba_write_bulk_callback(struct urb *urb)
-{
-       struct usb_serial_port *port = urb->context;
-       unsigned long flags;
-       int i;
-
-       dbg("%s - port %d", __func__, port->number);
-
-       for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) {
-               if (port->write_urbs[i] == urb)
-                       break;
-       }
-       spin_lock_irqsave(&port->lock, flags);
-       __set_bit(i, &port->write_urbs_free);
-       port->tx_bytes -= urb->transfer_buffer_length;
-       spin_unlock_irqrestore(&port->lock, flags);
-
-       if (urb->status)
-               dbg("%s - non-zero urb status: %d", __func__, urb->status);
-
-       usb_serial_port_softint(port);
-}
-
-static struct usb_serial_driver samba_device = {
-       .driver = {
-               .owner          = THIS_MODULE,
-               .name           = "sam-ba",
-       },
-       .usb_driver             = &samba_driver,
-       .id_table               = id_table,
-       .num_ports              = 1,
-       .bulk_in_size           = 512,
-       .bulk_out_size          = 2048,
-       .write                  = samba_write,
-       .write_room             = samba_write_room,
-       .chars_in_buffer        = samba_chars_in_buffer,
-       .write_bulk_callback    = samba_write_bulk_callback,
-       .throttle               = usb_serial_generic_throttle,
-       .unthrottle             = usb_serial_generic_unthrottle,
-};
-
-static int __init samba_init(void)
-{
-       int retval;
-
-       retval = usb_serial_register(&samba_device);
-       if (retval)
-               return retval;
-
-       retval = usb_register(&samba_driver);
-       if (retval) {
-               usb_serial_deregister(&samba_device);
-               return retval;
-       }
-
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ": "
-                                                       DRIVER_DESC "\n");
-       return 0;
-}
-
-static void __exit samba_exit(void)
-{
-       usb_deregister(&samba_driver);
-       usb_serial_deregister(&samba_device);
-}
-
-module_init(samba_init);
-module_exit(samba_exit);
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_VERSION(DRIVER_VERSION);
-MODULE_LICENSE("GPL");
-
-module_param(debug, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(debug, "Enable verbose debugging messages");