staging: dgnc: delete the driver

Digi does not support it, no one has hardware for it, and no one is
working on it, so let's drop it for now.  If anyone wants to pick it
back up, then can revert this patch.

Reported-by: Lidza Louina <lidza.louina@gmail.com>
Reported-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2018-10-02 15:14:14 -07:00
parent f3583dcd4d
commit 3268357865
13 changed files with 0 additions and 4723 deletions

View File

@ -4359,13 +4359,6 @@ L: linux-gpio@vger.kernel.org
S: Maintained
F: drivers/gpio/gpio-gpio-mm.c
DIGI NEO AND CLASSIC PCI PRODUCTS
M: Lidza Louina <lidza.louina@gmail.com>
M: Mark Hounschell <markh@compro.net>
L: driverdev-devel@linuxdriverproject.org
S: Maintained
F: drivers/staging/dgnc/
DIOLAN U2C-12 I2C DRIVER
M: Guenter Roeck <linux@roeck-us.net>
L: linux-i2c@vger.kernel.org

View File

@ -80,8 +80,6 @@ source "drivers/staging/netlogic/Kconfig"
source "drivers/staging/mt29f_spinand/Kconfig"
source "drivers/staging/dgnc/Kconfig"
source "drivers/staging/gs_fpgaboot/Kconfig"
source "drivers/staging/unisys/Kconfig"

View File

@ -29,7 +29,6 @@ obj-$(CONFIG_STAGING_BOARD) += board/
obj-$(CONFIG_LTE_GDM724X) += gdm724x/
obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/
obj-$(CONFIG_GOLDFISH) += goldfish/
obj-$(CONFIG_DGNC) += dgnc/
obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand/
obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/
obj-$(CONFIG_UNISYSSPAR) += unisys/

View File

@ -1,10 +0,0 @@
config DGNC
tristate "Digi Neo and Classic PCI Products"
default n
depends on TTY && PCI
help
Say Y here to enable support for the Digi International Neo and
Classic PCI based product line.
To compile this driver as a module, say M here: the module will be
called dgnc

View File

@ -1,4 +0,0 @@
obj-$(CONFIG_DGNC) += dgnc.o
dgnc-objs := dgnc_cls.o dgnc_driver.o\
dgnc_tty.o

View File

@ -1,6 +0,0 @@
* remove unnecessary comments
* there is a lot of unnecessary code in the driver. It was
originally a standalone driver. Remove unneeded code.
Please send patches to Greg Kroah-Hartman <greg@kroah.com> and
Cc: Lidza Louina <lidza.louina@gmail.com>

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*/
#ifndef _DGNC_CLS_H
#define _DGNC_CLS_H
/**
* struct cls_uart_struct - Per channel/port Classic UART.
*
* key - W = read write
* - R = read only
* - U = unused
*
* @txrx: (WR) Holding Register.
* @ier: (WR) Interrupt Enable Register.
* @isr_fcr: (WR) Interrupt Status Register/Fifo Control Register.
* @lcr: (WR) Line Control Register.
* @mcr: (WR) Modem Control Register.
* @lsr: (WR) Line Status Register.
* @msr: (WR) Modem Status Register.
* @spr: (WR) Scratch Pad Register.
*/
struct cls_uart_struct {
u8 txrx;
u8 ier;
u8 isr_fcr;
u8 lcr;
u8 mcr;
u8 lsr;
u8 msr;
u8 spr;
};
/* Where to read the interrupt register (8bits) */
#define UART_CLASSIC_POLL_ADDR_OFFSET 0x40
#define UART_EXAR654_ENHANCED_REGISTER_SET 0xBF
#define UART_16654_FCR_TXTRIGGER_16 0x10
#define UART_16654_FCR_RXTRIGGER_16 0x40
#define UART_16654_FCR_RXTRIGGER_56 0x80
/* Received CTS/RTS change of state */
#define UART_IIR_CTSRTS 0x20
/* Receiver data TIMEOUT */
#define UART_IIR_RDI_TIMEOUT 0x0C
/*
* These are the EXTENDED definitions for the Exar 654's Interrupt
* Enable Register.
*/
#define UART_EXAR654_EFR_ECB 0x10 /* Enhanced control bit */
#define UART_EXAR654_EFR_IXON 0x2 /* Receiver compares Xon1/Xoff1 */
#define UART_EXAR654_EFR_IXOFF 0x8 /* Transmit Xon1/Xoff1 */
#define UART_EXAR654_EFR_RTSDTR 0x40 /* Auto RTS/DTR Flow Control Enable */
#define UART_EXAR654_EFR_CTSDSR 0x80 /* Auto CTS/DSR Flow Control Enable */
#define UART_EXAR654_IER_XOFF 0x20 /* Xoff Interrupt Enable */
#define UART_EXAR654_IER_RTSDTR 0x40 /* Output Interrupt Enable */
#define UART_EXAR654_IER_CTSDSR 0x80 /* Input Interrupt Enable */
extern struct board_ops dgnc_cls_ops;
#endif /* _DGNC_CLS_H */

View File

@ -1,404 +0,0 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include "dgnc_driver.h"
#include "dgnc_tty.h"
#include "dgnc_cls.h"
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Digi International, http://www.digi.com");
MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line");
MODULE_SUPPORTED_DEVICE("dgnc");
static unsigned int dgnc_num_boards;
struct dgnc_board *dgnc_board[MAXBOARDS];
static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
static int dgnc_poll_tick = 20; /* Poll interval - 20 ms */
static ulong dgnc_poll_time; /* Time of next poll */
static uint dgnc_poll_stop; /* Used to tell poller to stop */
static struct timer_list dgnc_poll_timer;
#define DIGI_VID 0x114F
#define PCI_DEVICE_CLASSIC_4_DID 0x0028
#define PCI_DEVICE_CLASSIC_8_DID 0x0029
#define PCI_DEVICE_CLASSIC_4_422_DID 0x00D0
#define PCI_DEVICE_CLASSIC_8_422_DID 0x00D1
#define PCI_DEVICE_CLASSIC_4_PCI_NAME "ClassicBoard 4 PCI"
#define PCI_DEVICE_CLASSIC_8_PCI_NAME "ClassicBoard 8 PCI"
#define PCI_DEVICE_CLASSIC_4_422_PCI_NAME "ClassicBoard 4 422 PCI"
#define PCI_DEVICE_CLASSIC_8_422_PCI_NAME "ClassicBoard 8 422 PCI"
static const struct pci_device_id dgnc_pci_tbl[] = {
{PCI_DEVICE(DIGI_VID, PCI_DEVICE_CLASSIC_4_DID), .driver_data = 0},
{PCI_DEVICE(DIGI_VID, PCI_DEVICE_CLASSIC_4_422_DID), .driver_data = 1},
{PCI_DEVICE(DIGI_VID, PCI_DEVICE_CLASSIC_8_DID), .driver_data = 2},
{PCI_DEVICE(DIGI_VID, PCI_DEVICE_CLASSIC_8_422_DID), .driver_data = 3},
{0,}
};
MODULE_DEVICE_TABLE(pci, dgnc_pci_tbl);
struct board_id {
unsigned char *name;
uint maxports;
unsigned int is_pci_express;
};
static const struct board_id dgnc_ids[] = {
{ PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 },
{ PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 },
{ PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 },
{ PCI_DEVICE_CLASSIC_8_422_PCI_NAME, 8, 0 },
{ NULL, 0, 0 }
};
/* Remap PCI memory. */
static int dgnc_do_remap(struct dgnc_board *brd)
{
brd->re_map_membase = ioremap(brd->membase, 0x1000);
if (!brd->re_map_membase)
return -ENOMEM;
return 0;
}
/* A board has been found, initialize it. */
static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
{
struct dgnc_board *brd;
unsigned int pci_irq;
int rc = 0;
brd = kzalloc(sizeof(*brd), GFP_KERNEL);
if (!brd)
return ERR_PTR(-ENOMEM);
/* store the info for the board we've found */
brd->boardnum = dgnc_num_boards;
brd->device = dgnc_pci_tbl[id].device;
brd->pdev = pdev;
brd->name = dgnc_ids[id].name;
brd->maxports = dgnc_ids[id].maxports;
init_waitqueue_head(&brd->state_wait);
spin_lock_init(&brd->bd_lock);
spin_lock_init(&brd->bd_intr_lock);
brd->state = BOARD_FOUND;
pci_irq = pdev->irq;
brd->irq = pci_irq;
switch (brd->device) {
case PCI_DEVICE_CLASSIC_4_DID:
case PCI_DEVICE_CLASSIC_8_DID:
case PCI_DEVICE_CLASSIC_4_422_DID:
case PCI_DEVICE_CLASSIC_8_422_DID:
/*
* For PCI ClassicBoards
* PCI Local Address (i.e. "resource" number) space
* 0 PLX Memory Mapped Config
* 1 PLX I/O Mapped Config
* 2 I/O Mapped UARTs and Status
* 3 Memory Mapped VPD
* 4 Memory Mapped UARTs and Status
*/
brd->membase = pci_resource_start(pdev, 4);
if (!brd->membase) {
dev_err(&brd->pdev->dev,
"Card has no PCI IO resources, failing.\n");
rc = -ENODEV;
goto failed;
}
brd->membase_end = pci_resource_end(pdev, 4);
if (brd->membase & 1)
brd->membase &= ~3;
else
brd->membase &= ~15;
brd->iobase = pci_resource_start(pdev, 1);
brd->iobase_end = pci_resource_end(pdev, 1);
brd->iobase = ((unsigned int)(brd->iobase)) & 0xFFFE;
brd->bd_ops = &dgnc_cls_ops;
brd->bd_uart_offset = 0x8;
brd->bd_dividend = 921600;
rc = dgnc_do_remap(brd);
if (rc < 0)
goto failed;
/*
* Enable Local Interrupt 1 (0x1),
* Local Interrupt 1 Polarity Active high (0x2),
* Enable PCI interrupt (0x40)
*/
outb(0x43, brd->iobase + 0x4c);
break;
default:
dev_err(&brd->pdev->dev,
"Didn't find any compatible Neo/Classic PCI boards.\n");
rc = -ENXIO;
goto failed;
}
tasklet_init(&brd->helper_tasklet,
brd->bd_ops->tasklet,
(unsigned long)brd);
wake_up_interruptible(&brd->state_wait);
return brd;
failed:
kfree(brd);
return ERR_PTR(rc);
}
static int dgnc_request_irq(struct dgnc_board *brd)
{
if (brd->irq) {
int rc = request_irq(brd->irq, brd->bd_ops->intr,
IRQF_SHARED, "DGNC", brd);
if (rc) {
dev_err(&brd->pdev->dev,
"Failed to hook IRQ %d\n", brd->irq);
brd->state = BOARD_FAILED;
return -ENODEV;
}
}
return 0;
}
static void dgnc_free_irq(struct dgnc_board *brd)
{
if (brd->irq)
free_irq(brd->irq, brd);
}
/*
* As each timer expires, it determines (a) whether the "transmit"
* waiter needs to be woken up, and (b) whether the poller needs to
* be rescheduled.
*/
static void dgnc_poll_handler(struct timer_list *unused)
{
struct dgnc_board *brd;
unsigned long flags;
int i;
unsigned long new_time;
for (i = 0; i < dgnc_num_boards; i++) {
brd = dgnc_board[i];
spin_lock_irqsave(&brd->bd_lock, flags);
if (brd->state == BOARD_FAILED) {
spin_unlock_irqrestore(&brd->bd_lock, flags);
continue;
}
tasklet_schedule(&brd->helper_tasklet);
spin_unlock_irqrestore(&brd->bd_lock, flags);
}
/* Schedule ourself back at the nominal wakeup interval. */
spin_lock_irqsave(&dgnc_poll_lock, flags);
dgnc_poll_time += dgnc_jiffies_from_ms(dgnc_poll_tick);
new_time = dgnc_poll_time - jiffies;
if ((ulong)new_time >= 2 * dgnc_poll_tick)
dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
timer_setup(&dgnc_poll_timer, dgnc_poll_handler, 0);
dgnc_poll_timer.expires = dgnc_poll_time;
spin_unlock_irqrestore(&dgnc_poll_lock, flags);
if (!dgnc_poll_stop)
add_timer(&dgnc_poll_timer);
}
/* returns count (>= 0), or negative on error */
static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
int rc;
struct dgnc_board *brd;
rc = pci_enable_device(pdev);
if (rc)
return -EIO;
brd = dgnc_found_board(pdev, ent->driver_data);
if (IS_ERR(brd))
return PTR_ERR(brd);
rc = dgnc_tty_register(brd);
if (rc < 0) {
pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc);
goto failed;
}
rc = dgnc_request_irq(brd);
if (rc < 0) {
pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc);
goto unregister_tty;
}
rc = dgnc_tty_init(brd);
if (rc < 0) {
pr_err(DRVSTR ": Can't init tty devices (%d)\n", rc);
goto free_irq;
}
brd->state = BOARD_READY;
dgnc_board[dgnc_num_boards++] = brd;
return 0;
free_irq:
dgnc_free_irq(brd);
unregister_tty:
dgnc_tty_unregister(brd);
failed:
kfree(brd);
return rc;
}
static struct pci_driver dgnc_driver = {
.name = "dgnc",
.probe = dgnc_init_one,
.id_table = dgnc_pci_tbl,
};
static int dgnc_start(void)
{
unsigned long flags;
/* Start the poller */
spin_lock_irqsave(&dgnc_poll_lock, flags);
timer_setup(&dgnc_poll_timer, dgnc_poll_handler, 0);
dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
dgnc_poll_timer.expires = dgnc_poll_time;
spin_unlock_irqrestore(&dgnc_poll_lock, flags);
add_timer(&dgnc_poll_timer);
return 0;
}
/* Free all the memory associated with a board */
static void dgnc_cleanup_board(struct dgnc_board *brd)
{
int i = 0;
if (!brd)
return;
switch (brd->device) {
case PCI_DEVICE_CLASSIC_4_DID:
case PCI_DEVICE_CLASSIC_8_DID:
case PCI_DEVICE_CLASSIC_4_422_DID:
case PCI_DEVICE_CLASSIC_8_422_DID:
/* Tell card not to interrupt anymore. */
outb(0, brd->iobase + 0x4c);
break;
default:
break;
}
if (brd->irq)
free_irq(brd->irq, brd);
tasklet_kill(&brd->helper_tasklet);
if (brd->re_map_membase) {
iounmap(brd->re_map_membase);
brd->re_map_membase = NULL;
}
for (i = 0; i < MAXPORTS ; i++) {
if (brd->channels[i]) {
kfree(brd->channels[i]->ch_rqueue);
kfree(brd->channels[i]->ch_equeue);
kfree(brd->channels[i]->ch_wqueue);
kfree(brd->channels[i]);
brd->channels[i] = NULL;
}
}
dgnc_board[brd->boardnum] = NULL;
kfree(brd);
}
/* Driver load/unload functions */
static void cleanup(void)
{
int i;
unsigned long flags;
spin_lock_irqsave(&dgnc_poll_lock, flags);
dgnc_poll_stop = 1;
spin_unlock_irqrestore(&dgnc_poll_lock, flags);
/* Turn off poller right away. */
del_timer_sync(&dgnc_poll_timer);
for (i = 0; i < dgnc_num_boards; ++i) {
dgnc_cleanup_tty(dgnc_board[i]);
dgnc_cleanup_board(dgnc_board[i]);
}
}
static void __exit dgnc_cleanup_module(void)
{
cleanup();
pci_unregister_driver(&dgnc_driver);
}
static int __init dgnc_init_module(void)
{
int rc;
/* Initialize global stuff */
rc = dgnc_start();
if (rc < 0)
return rc;
/* Find and configure all the cards */
rc = pci_register_driver(&dgnc_driver);
if (rc) {
pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n");
cleanup();
return rc;
}
return 0;
}
module_init(dgnc_init_module);
module_exit(dgnc_cleanup_module);

View File

@ -1,345 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*/
#ifndef _DGNC_DRIVER_H
#define _DGNC_DRIVER_H
#include <linux/types.h>
#include <linux/tty.h>
#include <linux/interrupt.h>
#include "digi.h" /* Digi specific ioctl header */
/* Driver identification and error statements */
#define PROCSTR "dgnc" /* /proc entries */
#define DEVSTR "/dev/dg/dgnc" /* /dev entries */
#define DRVSTR "dgnc" /* Driver name string */
#define DG_PART "40002369_F" /* RPM part number */
#define TRC_TO_CONSOLE 1
/* Number of boards we support at once. */
#define MAXBOARDS 20
#define MAXPORTS 8
#define MAXTTYNAMELEN 200
/* Serial port types */
#define DGNC_SERIAL 0
#define DGNC_PRINT 1
#define SERIAL_TYPE_NORMAL 1
#define PORT_NUM(dev) ((dev) & 0x7f)
#define IS_PRINT(dev) (((dev) & 0xff) >= 0x80)
/* MAX number of stop characters sent when our read queue is getting full */
#define MAX_STOPS_SENT 5
/* 4 extra for alignment play space */
#define WRITEBUFLEN ((4096) + 4)
#define dgnc_jiffies_from_ms(a) (((a) * HZ) / 1000)
#ifndef _POSIX_VDISABLE
#define _POSIX_VDISABLE '\0'
#endif
/* All the possible states the driver can be while being loaded. */
enum {
DRIVER_INITIALIZED = 0,
DRIVER_READY
};
/* All the possible states the board can be while booting up. */
enum {
BOARD_FAILED = 0,
BOARD_FOUND,
BOARD_READY
};
struct dgnc_board;
struct channel_t;
/**
* struct board_ops - Per board operations.
*/
struct board_ops {
void (*tasklet)(unsigned long data);
irqreturn_t (*intr)(int irq, void *voidbrd);
void (*uart_init)(struct channel_t *ch);
void (*uart_off)(struct channel_t *ch);
int (*drain)(struct tty_struct *tty, uint seconds);
void (*param)(struct tty_struct *tty);
void (*assert_modem_signals)(struct channel_t *ch);
void (*flush_uart_write)(struct channel_t *ch);
void (*flush_uart_read)(struct channel_t *ch);
void (*disable_receiver)(struct channel_t *ch);
void (*enable_receiver)(struct channel_t *ch);
void (*send_break)(struct channel_t *ch, int msec);
void (*send_start_character)(struct channel_t *ch);
void (*send_stop_character)(struct channel_t *ch);
void (*copy_data_from_queue_to_uart)(struct channel_t *ch);
uint (*get_uart_bytes_left)(struct channel_t *ch);
void (*send_immediate_char)(struct channel_t *ch, unsigned char c);
};
/**
* struct dgnc_board - Per board information.
* @boardnum: Board number (0 - 32).
*
* @name: Product name.
* @pdev: Pointer to the pci_dev structure.
* @device: PCI device ID.
* @maxports: Maximum ports this board can handle.
* @bd_lock: Used to protect board.
* @bd_intr_lock: Protect poller tasklet and interrupt routine from each other.
* @state: State of the card.
* @state_wait: Queue to sleep on for state change.
* @helper_tasklet: Poll helper tasklet.
* @nasync: Number of ports on card.
* @irq: Interrupt request number.
* @membase: Start of base memory of the card.
* @membase_end: End of base memory of the card.
* @iobase: Start of IO base of the card.
* @iobase_end: End of IO base of the card.
* @bd_uart_offset: Space between each UART.
* @channels: array of pointers to our channels.
* @serial_driver: Pointer to the serial driver.
* @serial_name: Serial driver name.
* @print_dirver: Pointer to the print driver.
* @print_name: Print driver name.
* @bd_dividend: Board/UART's specific dividend.
* @bd_ops: Pointer to board operations structure.
*/
struct dgnc_board {
int boardnum;
char *name;
struct pci_dev *pdev;
u16 device;
uint maxports;
/* used to protect the board */
spinlock_t bd_lock;
/* Protect poller tasklet and interrupt routine from each other. */
spinlock_t bd_intr_lock;
uint state;
wait_queue_head_t state_wait;
struct tasklet_struct helper_tasklet;
uint nasync;
uint irq;
ulong membase;
ulong membase_end;
u8 __iomem *re_map_membase;
ulong iobase;
ulong iobase_end;
uint bd_uart_offset;
struct channel_t *channels[MAXPORTS];
struct tty_driver *serial_driver;
char serial_name[200];
struct tty_driver *print_driver;
char print_name[200];
uint bd_dividend;
struct board_ops *bd_ops;
};
/* Unit flag definitions for un_flags. */
#define UN_ISOPEN 0x0001 /* Device is open */
#define UN_CLOSING 0x0002 /* Line is being closed */
#define UN_IMM 0x0004 /* Service immediately */
#define UN_BUSY 0x0008 /* Some work this channel */
#define UN_BREAKI 0x0010 /* Input break received */
#define UN_PWAIT 0x0020 /* Printer waiting for terminal */
#define UN_TIME 0x0040 /* Waiting on time */
#define UN_EMPTY 0x0080 /* Waiting output queue empty */
#define UN_LOW 0x0100 /* Waiting output low water mark*/
#define UN_EXCL_OPEN 0x0200 /* Open for exclusive use */
#define UN_WOPEN 0x0400 /* Device waiting for open */
#define UN_WIOCTL 0x0800 /* Device waiting for open */
#define UN_HANGUP 0x8000 /* Carrier lost */
struct device;
/**
* struct un_t - terminal or printer unit
* @un_open_count: Counter of opens to port.
* @un_tty: Pointer to unit tty structure.
* @un_flags: Unit flags.
* @un_flags_wait: Place to sleep to wait on unit.
* @un_dev: Minor device number.
*/
struct un_t {
struct channel_t *un_ch;
uint un_type;
uint un_open_count;
struct tty_struct *un_tty;
uint un_flags;
wait_queue_head_t un_flags_wait;
uint un_dev;
struct device *un_sysfs;
};
/* Device flag definitions for ch_flags. */
#define CH_PRON 0x0001 /* Printer on string */
#define CH_STOP 0x0002 /* Output is stopped */
#define CH_STOPI 0x0004 /* Input is stopped */
#define CH_CD 0x0008 /* Carrier is present */
#define CH_FCAR 0x0010 /* Carrier forced on */
#define CH_HANGUP 0x0020 /* Hangup received */
#define CH_RECEIVER_OFF 0x0040 /* Receiver is off */
#define CH_OPENING 0x0080 /* Port in fragile open state */
#define CH_CLOSING 0x0100 /* Port in fragile close state */
#define CH_FIFO_ENABLED 0x0200 /* Port has FIFOs enabled */
#define CH_TX_FIFO_EMPTY 0x0400 /* TX Fifo is completely empty */
#define CH_TX_FIFO_LWM 0x0800 /* TX Fifo is below Low Water */
#define CH_BREAK_SENDING 0x1000 /* Break is being sent */
#define CH_LOOPBACK 0x2000 /* Channel is in lookback mode */
#define CH_BAUD0 0x08000 /* Used for checking B0 transitions */
#define CH_FORCED_STOP 0x20000 /* Output is forcibly stopped */
#define CH_FORCED_STOPI 0x40000 /* Input is forcibly stopped */
/* Our Read/Error/Write queue sizes */
#define RQUEUEMASK 0x1FFF /* 8 K - 1 */
#define EQUEUEMASK 0x1FFF /* 8 K - 1 */
#define WQUEUEMASK 0x0FFF /* 4 K - 1 */
#define RQUEUESIZE (RQUEUEMASK + 1)
#define EQUEUESIZE RQUEUESIZE
#define WQUEUESIZE (WQUEUEMASK + 1)
/**
* struct channel_t - Channel information.
* @dgnc_board: Pointer to board structure.
* @ch_bd: Transparent print structure.
* @ch_tun: Terminal unit information.
* @ch_pun: Printer unit information.
* @ch_lock: Provide for serialization.
* @ch_flags_wait: Channel flags wait queue.
* @ch_portnum: Port number, 0 offset.
* @ch_open_count: Open count.
* @ch_flags: Channel flags.
* @ch_close_delay: How long we should drop RTS/DTR for.
* @ch_cpstime: Time for CPS calculations.
* @ch_c_iflag: Channel iflags.
* @ch_c_cflag: Channel cflags.
* @ch_c_oflag: Channel oflags.
* @ch_c_lflag: Channel lflags.
* @ch_stopc: Stop character.
* @ch_startc: Start character.
* @ch_old_baud: Cache of the current baud rate.
* @ch_custom_speed: Custom baud rate, if set.
* @ch_wopen: Waiting for open process count.
* @ch_mostat: FEP output modem status.
* @ch_mistat: FEP input modem status.
* @ch_cls_uart: Pointer to the mapped cls UART struct
* @ch_cached_lsr: Cached value of the LSR register.
* @ch_rqueue: Read queue buffer, malloc'ed.
* @ch_r_head: Head location of the read queue.
* @ch_r_tail: Tail location of the read queue.
* @ch_equeue: Error queue buffer, malloc'ed.
* @ch_e_head: Head location of the error queue.
* @ch_e_tail: Tail location of the error queue.
* @ch_wqueue: Write queue buffer, malloc'ed.
* @ch_w_head: Head location of the write queue.
* @ch_w_tail: Tail location of the write queue.
* @ch_rxcount: Total of data received so far.
* @ch_txcount: Total of data transmitted so far.
* @ch_r_tlevel: Receive trigger level.
* @ch_t_tlevel: Transmit trigger level.
* @ch_r_watermark: Receive water mark.
* @ch_stop_sending_break: Time we should STOP sending a break.
* @ch_stops_sent: How many times I have send a stop character to try
* to stop the other guy sending.
* @ch_err_parity: Count of parity
* @ch_err_frame: Count of framing errors on channel.
* @ch_err_break: Count of breaks on channel.
* @ch_err_overrun: Count of overruns on channel.
* @ch_xon_sends: Count of xons transmitted.
* @ch_xoff_sends: Count of xoffs transmitted.
*/
struct channel_t {
struct dgnc_board *ch_bd;
struct digi_t ch_digi;
struct un_t ch_tun;
struct un_t ch_pun;
spinlock_t ch_lock; /* provide for serialization */
wait_queue_head_t ch_flags_wait;
uint ch_portnum;
uint ch_open_count;
uint ch_flags;
ulong ch_close_delay;
ulong ch_cpstime;
tcflag_t ch_c_iflag;
tcflag_t ch_c_cflag;
tcflag_t ch_c_oflag;
tcflag_t ch_c_lflag;
unsigned char ch_stopc;
unsigned char ch_startc;
uint ch_old_baud;
uint ch_custom_speed;
uint ch_wopen;
unsigned char ch_mostat;
unsigned char ch_mistat;
struct cls_uart_struct __iomem *ch_cls_uart;
unsigned char ch_cached_lsr;
unsigned char *ch_rqueue;
ushort ch_r_head;
ushort ch_r_tail;
unsigned char *ch_equeue;
ushort ch_e_head;
ushort ch_e_tail;
unsigned char *ch_wqueue;
ushort ch_w_head;
ushort ch_w_tail;
ulong ch_rxcount;
ulong ch_txcount;
unsigned char ch_r_tlevel;
unsigned char ch_t_tlevel;
unsigned char ch_r_watermark;
ulong ch_stop_sending_break;
uint ch_stops_sent;
ulong ch_err_parity;
ulong ch_err_frame;
ulong ch_err_break;
ulong ch_err_overrun;
ulong ch_xon_sends;
ulong ch_xoff_sends;
};
extern struct dgnc_board *dgnc_board[MAXBOARDS];/* Array of boards */
#endif /* _DGNC_DRIVER_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*/
#ifndef _DGNC_TTY_H
#define _DGNC_TTY_H
#include "dgnc_driver.h"
int dgnc_tty_register(struct dgnc_board *brd);
void dgnc_tty_unregister(struct dgnc_board *brd);
int dgnc_tty_init(struct dgnc_board *brd);
void dgnc_cleanup_tty(struct dgnc_board *brd);
void dgnc_input(struct channel_t *ch);
void dgnc_carrier(struct channel_t *ch);
void dgnc_wakeup_writes(struct channel_t *ch);
void dgnc_check_queue_flow_control(struct channel_t *ch);
#endif /* _DGNC_TTY_H */

View File

@ -1,128 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*/
#ifndef _DIGI_H
#define _DIGI_H
#define DIGI_GETA (('e' << 8) | 94) /* Read params */
#define DIGI_SETA (('e' << 8) | 95) /* Set params */
#define DIGI_SETAW (('e' << 8) | 96) /* Drain & set params */
#define DIGI_SETAF (('e' << 8) | 97) /* Drain, flush & set params */
#define DIGI_LOOPBACK (('d' << 8) | 252) /* Enable/disable UART
* internal loopback
*/
#define DIGI_FAST 0x0002 /* Fast baud rates */
#define RTSPACE 0x0004 /* RTS input flow control */
#define CTSPACE 0x0008 /* CTS output flow control */
#define DIGI_COOK 0x0080 /* Cooked processing done in FEP */
#define DIGI_FORCEDCD 0x0100 /* Force carrier */
#define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
#define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/
#define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */
#define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */
#define DIGI_PLEN 28 /* String length */
#define DIGI_TSIZ 10 /* Terminal string len */
/*
* Structure used with ioctl commands for DIGI parameters.
*/
/**
* struct digi_t - Ioctl commands for DIGI parameters.
* @digi_flags: Flags.
* @digi_maxcps: Maximum printer CPS.
* @digi_maxchar: Maximum characters in the print queue.
* @digi_bufsize: Buffer size.
* @digi_onlen: Length of ON string.
* @digi_offlen: Length of OFF string.
* @digi_onstr: Printer ON string.
* @digi_offstr: Printer OFF string.
* @digi_term: Terminal string.
*/
struct digi_t {
unsigned short digi_flags;
unsigned short digi_maxcps;
unsigned short digi_maxchar;
unsigned short digi_bufsize;
unsigned char digi_onlen;
unsigned char digi_offlen;
char digi_onstr[DIGI_PLEN];
char digi_offstr[DIGI_PLEN];
char digi_term[DIGI_TSIZ];
};
/**
* struct digi_getbuffer - Holds buffer use counts.
*/
struct digi_getbuffer {
unsigned long tx_in;
unsigned long tx_out;
unsigned long rxbuf;
unsigned long txbuf;
unsigned long txdone;
};
/**
* struct digi_getcounter
* @norun: Number of UART overrun errors.
* @noflow: Number of buffer overflow errors.
* @nframe: Number of framing errors.
* @nparity: Number of parity errors.
* @nbreak: Number of breaks received.
* @rbytes: Number of received bytes.
* @tbytes: Number of transmitted bytes.
*/
struct digi_getcounter {
unsigned long norun;
unsigned long noflow;
unsigned long nframe;
unsigned long nparity;
unsigned long nbreak;
unsigned long rbytes;
unsigned long tbytes;
};
#define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */
#define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */
#define DIGI_REALPORT_GETBUFFERS (('e' << 8) | 108)
#define DIGI_REALPORT_SENDIMMEDIATE (('e' << 8) | 109)
#define DIGI_REALPORT_GETCOUNTERS (('e' << 8) | 110)
#define DIGI_REALPORT_GETEVENTS (('e' << 8) | 111)
#define EV_OPU 0x0001 /* Output paused by client */
#define EV_OPS 0x0002 /* Output paused by regular sw flowctrl */
#define EV_IPU 0x0010 /* Input paused unconditionally by user */
#define EV_IPS 0x0020 /* Input paused by high/low water marks */
#define EV_TXB 0x0040 /* Transmit break pending */
/**
* struct ni_info - intelligent <--> non-intelligent DPA translation.
*/
struct ni_info {
int board;
int channel;
int dtr;
int rts;
int cts;
int dsr;
int ri;
int dcd;
int curtx;
int currx;
unsigned short iflag;
unsigned short oflag;
unsigned short cflag;
unsigned short lflag;
unsigned int mstat;
unsigned char hflow;
unsigned char xmit_stopped;
unsigned char recv_stopped;
unsigned int baud;
};
#define TTY_FLIPBUF_SIZE 512
#endif /* _DIGI_H */