linux/drivers/gpio/gpio-pcie-idio-24.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * GPIO driver for the ACCES PCIe-IDIO-24 family
 * Copyright (C) 2018 William Breathitt Gray
 *
 * This driver supports the following ACCES devices: PCIe-IDIO-24,
 * PCIe-IDI-24, PCIe-IDO-24, and PCIe-IDIO-12.
 */
#include <linux/bits.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio/regmap.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/regmap.h>
#include <linux/spinlock.h>
#include <linux/types.h>

/*
 * PLX PEX8311 PCI LCS_INTCSR Interrupt Control/Status
 *
 * Bit: Description
 *   0: Enable Interrupt Sources (Bit 0)
 *   1: Enable Interrupt Sources (Bit 1)
 *   2: Generate Internal PCI Bus Internal SERR# Interrupt
 *   3: Mailbox Interrupt Enable
 *   4: Power Management Interrupt Enable
 *   5: Power Management Interrupt
 *   6: Slave Read Local Data Parity Check Error Enable
 *   7: Slave Read Local Data Parity Check Error Status
 *   8: Internal PCI Wire Interrupt Enable
 *   9: PCI Express Doorbell Interrupt Enable
 *  10: PCI Abort Interrupt Enable
 *  11: Local Interrupt Input Enable
 *  12: Retry Abort Enable
 *  13: PCI Express Doorbell Interrupt Active
 *  14: PCI Abort Interrupt Active
 *  15: Local Interrupt Input Active
 *  16: Local Interrupt Output Enable
 *  17: Local Doorbell Interrupt Enable
 *  18: DMA Channel 0 Interrupt Enable
 *  19: DMA Channel 1 Interrupt Enable
 *  20: Local Doorbell Interrupt Active
 *  21: DMA Channel 0 Interrupt Active
 *  22: DMA Channel 1 Interrupt Active
 *  23: Built-In Self-Test (BIST) Interrupt Active
 *  24: Direct Master was the Bus Master during a Master or Target Abort
 *  25: DMA Channel 0 was the Bus Master during a Master or Target Abort
 *  26: DMA Channel 1 was the Bus Master during a Master or Target Abort
 *  27: Target Abort after internal 256 consecutive Master Retrys
 *  28: PCI Bus wrote data to LCS_MBOX0
 *  29: PCI Bus wrote data to LCS_MBOX1
 *  30: PCI Bus wrote data to LCS_MBOX2
 *  31: PCI Bus wrote data to LCS_MBOX3
 */
#define PLX_PEX8311_PCI_LCS_INTCSR
#define INTCSR_INTERNAL_PCI_WIRE
#define INTCSR_LOCAL_INPUT
#define IDIO_24_ENABLE_IRQ

#define IDIO_24_OUT_BASE
#define IDIO_24_TTLCMOS_OUT_REG
#define IDIO_24_IN_BASE
#define IDIO_24_TTLCMOS_IN_REG
#define IDIO_24_COS_STATUS_BASE
#define IDIO_24_CONTROL_REG
#define IDIO_24_COS_ENABLE
#define IDIO_24_SOFT_RESET

#define CONTROL_REG_OUT_MODE

#define COS_ENABLE_RISING
#define COS_ENABLE_FALLING
#define COS_ENABLE_BOTH

static const struct regmap_config pex8311_intcsr_regmap_config =;

static const struct regmap_range idio_24_wr_ranges[] =;
static const struct regmap_range idio_24_rd_ranges[] =;
static const struct regmap_range idio_24_volatile_ranges[] =;
static const struct regmap_access_table idio_24_wr_table =;
static const struct regmap_access_table idio_24_rd_table =;
static const struct regmap_access_table idio_24_volatile_table =;

static const struct regmap_config idio_24_regmap_config =;

#define IDIO_24_NGPIO_PER_REG
#define IDIO_24_REGMAP_IRQ(_id)
#define IDIO_24_IIN_IRQ(_id)
#define IDIO_24_TTL_IRQ(_id)

static const struct regmap_irq idio_24_regmap_irqs[] =;

/**
 * struct idio_24_gpio - GPIO device private data structure
 * @map:	regmap for the device
 * @lock:	synchronization lock to prevent I/O race conditions
 * @irq_type:	type configuration for IRQs
 */
struct idio_24_gpio {};

static int idio_24_handle_mask_sync(const int index, const unsigned int mask_buf_def,
				    const unsigned int mask_buf, void *const irq_drv_data)
{}

static int idio_24_set_type_config(unsigned int **const buf, const unsigned int type,
				   const struct regmap_irq *const irq_data, const int idx,
				   void *const irq_drv_data)
{}

static int idio_24_reg_mask_xlate(struct gpio_regmap *const gpio, const unsigned int base,
				  const unsigned int offset, unsigned int *const reg,
				  unsigned int *const mask)
{}

#define IDIO_24_NGPIO
static const char *idio_24_names[IDIO_24_NGPIO] =;

static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static const struct pci_device_id idio_24_pci_dev_id[] =;
MODULE_DEVICE_TABLE(pci, idio_24_pci_dev_id);

static struct pci_driver idio_24_driver =;

module_pci_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();