diff options
Diffstat (limited to 'drivers/gpib')
| -rw-r--r-- | drivers/gpib/agilent_82357a/agilent_82357a.c | 2 | ||||
| -rw-r--r-- | drivers/gpib/common/gpib_os.c | 11 | ||||
| -rw-r--r-- | drivers/gpib/eastwood/fluke_gpib.c | 1 | ||||
| -rw-r--r-- | drivers/gpib/ines/ines.h | 16 | ||||
| -rw-r--r-- | drivers/gpib/ines/ines_gpib.c | 90 | ||||
| -rw-r--r-- | drivers/gpib/ni_usb/ni_usb_gpib.c | 2 |
6 files changed, 109 insertions, 13 deletions
diff --git a/drivers/gpib/agilent_82357a/agilent_82357a.c b/drivers/gpib/agilent_82357a/agilent_82357a.c index 770ba6eb40d1..2468a471d175 100644 --- a/drivers/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/gpib/agilent_82357a/agilent_82357a.c @@ -1298,7 +1298,7 @@ static inline int agilent_82357a_device_match(struct usb_interface *interface, if (gpib_match_device_path(&interface->dev, config->device_path) == 0) return 0; if (config->serial_number && - strcmp(usbdev->serial, config->serial_number) != 0) + (!usbdev->serial || strcmp(usbdev->serial, config->serial_number) != 0)) return 0; return 1; diff --git a/drivers/gpib/common/gpib_os.c b/drivers/gpib/common/gpib_os.c index 5909274ddc12..69f6aa73ab9a 100644 --- a/drivers/gpib/common/gpib_os.c +++ b/drivers/gpib/common/gpib_os.c @@ -544,13 +544,6 @@ int ibopen(struct inode *inode, struct file *filep) priv = filep->private_data; init_gpib_file_private((struct gpib_file_private *)filep->private_data); - if (board->use_count == 0) { - int retval; - - retval = request_module("gpib%i", minor); - if (retval) - dev_dbg(board->gpib_dev, "request module returned %i\n", retval); - } if (board->interface) { if (!try_module_get(board->provider_module)) { dev_err(board->gpib_dev, "try_module_get() failed\n"); @@ -613,7 +606,7 @@ long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg) unsigned int minor = iminor(file_inode(filep)); struct gpib_board *board; struct gpib_file_private *file_priv = filep->private_data; - long retval = -ENOTTY; + long retval = -EBADRQC; if (minor >= GPIB_MAX_NUM_BOARDS) { pr_err("gpib: invalid minor number of device file\n"); @@ -806,7 +799,6 @@ long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg) mutex_unlock(&board->big_gpib_mutex); return write_ioctl(file_priv, board, arg); default: - retval = -ENOTTY; goto done; } @@ -1018,7 +1010,6 @@ static int command_ioctl(struct gpib_file_private *file_priv, userbuf += bytes_written; if (retval < 0) { atomic_set(&desc->io_in_progress, 0); - atomic_dec(&desc->descriptor_busy); wake_up_interruptible(&board->wait); break; diff --git a/drivers/gpib/eastwood/fluke_gpib.c b/drivers/gpib/eastwood/fluke_gpib.c index 2069c771ecef..1363f0a1f570 100644 --- a/drivers/gpib/eastwood/fluke_gpib.c +++ b/drivers/gpib/eastwood/fluke_gpib.c @@ -17,7 +17,6 @@ #include <linux/dma-mapping.h> #include <linux/ioport.h> #include <linux/module.h> -#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/slab.h> diff --git a/drivers/gpib/ines/ines.h b/drivers/gpib/ines/ines.h index 6ad57e9a1216..22af59682870 100644 --- a/drivers/gpib/ines/ines.h +++ b/drivers/gpib/ines/ines.h @@ -21,6 +21,7 @@ enum ines_pci_chip { PCI_CHIP_AMCC5920, PCI_CHIP_QUANCOM, PCI_CHIP_QUICKLOGIC5030, + PCI_CHIP_INES_72130, }; struct ines_priv { @@ -162,4 +163,19 @@ enum ines_auxd_bits { INES_T6_50us = 0x10, }; +enum ines72130_regs { + BUS_STATUS_REG = 0xc, +}; + +enum ines_72130_bus_status_bits { + BSR_NRFD_BIT = 0x1, + BSR_NDAC_BIT = 0x2, + BSR_DAV_BIT = 0x4, + BSR_EOI_BIT = 0x8, + BSR_SRQ_BIT = 0x10, + BSR_ATN_BIT = 0x20, + BSR_REN_BIT = 0x40, + BSR_IFC_BIT = 0x80, +}; + #endif // _INES_GPIB_H diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c index c000f647fbb5..3562f3184c28 100644 --- a/drivers/gpib/ines/ines_gpib.c +++ b/drivers/gpib/ines/ines_gpib.c @@ -57,6 +57,34 @@ static int ines_line_status(const struct gpib_board *board) return status; } +static int ines72130_line_status(const struct gpib_board *board) +{ + int status = VALID_ALL; + int bsr_bits; + struct ines_priv *ines_priv = board->private_data; + + bsr_bits = ines_inb(ines_priv, BUS_STATUS_REG); + + if (bsr_bits & BSR_REN_BIT) + status |= BUS_REN; + if (bsr_bits & BSR_IFC_BIT) + status |= BUS_IFC; + if (bsr_bits & BSR_SRQ_BIT) + status |= BUS_SRQ; + if (bsr_bits & BSR_EOI_BIT) + status |= BUS_EOI; + if (bsr_bits & BSR_NRFD_BIT) + status |= BUS_NRFD; + if (bsr_bits & BSR_NDAC_BIT) + status |= BUS_NDAC; + if (bsr_bits & BSR_DAV_BIT) + status |= BUS_DAV; + if (bsr_bits & BSR_ATN_BIT) + status |= BUS_ATN; + + return status; +} + static void ines_set_xfer_counter(struct ines_priv *priv, unsigned int count) { if (count > 0xffff) { @@ -75,6 +103,9 @@ static int ines_t1_delay(struct gpib_board *board, unsigned int nano_sec) retval = nec7210_t1_delay(board, nec_priv, nano_sec); + if (ines_priv->pci_chip_type == PCI_CHIP_INES_72130) + return retval; + if (nano_sec <= 250) { write_byte(nec_priv, INES_AUXD | INES_FOLLOWING_T1_250ns | INES_INITIAL_T1_2000ns, AUXMR); @@ -294,6 +325,8 @@ static irqreturn_t ines_interrupt(struct gpib_board *board) spin_lock_irqsave(&board->spinlock, flags); nec7210_interrupt(board, nec_priv); + if (priv->pci_chip_type == PCI_CHIP_INES_72130) + goto out; isr3_bits = ines_inb(priv, ISR3); isr4_bits = ines_inb(priv, ISR4); if (isr3_bits & IFC_ACTIVE_BIT) { @@ -311,11 +344,13 @@ static irqreturn_t ines_interrupt(struct gpib_board *board) if (wake) wake_up_interruptible(&board->wait); +out: spin_unlock_irqrestore(&board->spinlock, flags); return IRQ_HANDLED; } static int ines_pci_attach(struct gpib_board *board, const struct gpib_board_config *config); +static int ines_pci_xl_attach(struct gpib_board *board, const struct gpib_board_config *config); static int ines_pci_accel_attach(struct gpib_board *board, const struct gpib_board_config *config); static int ines_isa_attach(struct gpib_board *board, const struct gpib_board_config *config); @@ -569,6 +604,34 @@ static struct gpib_interface ines_pci_unaccel_interface = { .return_to_local = ines_return_to_local, }; +static struct gpib_interface ines_pci_xl_interface = { + .name = "ines_pci_xl", + .attach = ines_pci_xl_attach, + .detach = ines_pci_detach, + .read = ines_read, + .write = ines_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines72130_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, +}; + static struct gpib_interface ines_pci_interface = { .name = "ines_pci", .attach = ines_pci_accel_attach, @@ -870,6 +933,24 @@ static int ines_pci_attach(struct gpib_board *board, const struct gpib_board_con return 0; } +static int ines_pci_xl_attach(struct gpib_board *board, const struct gpib_board_config *config) +{ + struct ines_priv *ines_priv; + struct nec7210_priv *nec_priv; + int retval; + + retval = ines_common_pci_attach(board, config); + if (retval < 0) + return retval; + + ines_priv = board->private_data; + ines_priv->pci_chip_type = PCI_CHIP_INES_72130; + nec_priv = &ines_priv->nec7210_priv; + nec7210_board_online(nec_priv, board); + + return 0; +} + static int ines_pci_accel_attach(struct gpib_board *board, const struct gpib_board_config *config) { struct ines_priv *ines_priv; @@ -1419,6 +1500,12 @@ static int __init ines_init_module(void) goto err_pci_unaccel; } + ret = gpib_register_driver(&ines_pci_xl_interface, THIS_MODULE); + if (ret) { + pr_err("gpib_register_driver failed: error = %d\n", ret); + goto err_pci_xl; + } + ret = gpib_register_driver(&ines_pci_accel_interface, THIS_MODULE); if (ret) { pr_err("gpib_register_driver failed: error = %d\n", ret); @@ -1473,6 +1560,8 @@ err_isa: gpib_unregister_driver(&ines_pci_accel_interface); err_pci_accel: gpib_unregister_driver(&ines_pci_unaccel_interface); +err_pci_xl: + gpib_unregister_driver(&ines_pci_xl_interface); err_pci_unaccel: gpib_unregister_driver(&ines_pci_interface); err_pci: @@ -1485,6 +1574,7 @@ static void __exit ines_exit_module(void) { gpib_unregister_driver(&ines_pci_interface); gpib_unregister_driver(&ines_pci_unaccel_interface); + gpib_unregister_driver(&ines_pci_xl_interface); gpib_unregister_driver(&ines_pci_accel_interface); gpib_unregister_driver(&ines_isa_interface); #ifdef CONFIG_GPIB_PCMCIA diff --git a/drivers/gpib/ni_usb/ni_usb_gpib.c b/drivers/gpib/ni_usb/ni_usb_gpib.c index 0bbc13ecebf9..28de1d543ad6 100644 --- a/drivers/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/gpib/ni_usb/ni_usb_gpib.c @@ -720,7 +720,7 @@ static int ni_usb_read(struct gpib_board *board, u8 *buffer, size_t length, break; } ni_usb_soft_update_status(board, status.ibsta, 0); - if (status.ibsta & END) + if ((status.ibsta & END) && (status.error_code == NIUSB_NO_ERROR)) *end = 1; else *end = 0; |
