// SPDX-License-Identifier: GPL-2.0-only
/*
* w6692.c mISDN driver for Winbond w6692 based cards
*
* Author Karsten Keil <kkeil@suse.de>
* based on the w6692 I4L driver from Petr Novak <petr.novak@i.cz>
*
* Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
*/
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/mISDNhw.h>
#include <linux/slab.h>
#include "w6692.h"
#define W6692_REV "2.0"
#define DBUSY_TIMER_VALUE 80
enum {
W6692_ASUS,
W6692_WINBOND,
W6692_USR
};
/* private data in the PCI devices list */
struct w6692map {
u_int subtype;
char *name;
};
static const struct w6692map w6692_map[] =
{
{W6692_ASUS, "Dynalink/AsusCom IS64PH"},
{W6692_WINBOND, "Winbond W6692"},
{W6692_USR, "USR W6692"}
};
#define PCI_DEVICE_ID_USR_6692 0x3409
struct w6692_ch {
struct bchannel bch;
u32 addr;
struct timer_list timer;
u8 b_mode;
};
struct w6692_hw {
struct list_head list;
struct pci_dev *pdev;
char name[MISDN_MAX_IDLEN];
u32 irq;
u32 irqcnt;
u32 addr;
u32 fmask; /* feature mask - bit set per card nr */
int subtype;
spinlock_t lock; /* hw lock */
u8 imask;
u8 pctl;
u8 xaddr;
u8 xdata;
u8 state;
struct w6692_ch bc[2];
struct dchannel dch;
char log[64];
};
static LIST_HEAD(Cards);
static DEFINE_RWLOCK(card_lock); /* protect Cards */
static int w6692_cnt;
static int debug;
static u32 led;
static u32 pots;
static void
_set_debug(struct w6692_hw *card)
{
card->dch.debug = debug;
card->bc[0].bch.debug = debug;
card->bc[1].bch.debug = debug;
}