// 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 0x68 #define INTCSR_INTERNAL_PCI_WIRE BIT(8) #define INTCSR_LOCAL_INPUT BIT(11) #define IDIO_24_ENABLE_IRQ (INTCSR_INTERNAL_PCI_WIRE | INTCSR_LOCAL_INPUT)
switch (type) { case IRQ_TYPE_EDGE_RISING: new = rising; break; case IRQ_TYPE_EDGE_FALLING: new = falling; break; case IRQ_TYPE_EDGE_BOTH: new = mask; break; default: return -EINVAL;
}
raw_spin_lock(&idio24gpio->lock);
/* replace old bitmap with new bitmap */
idio24gpio->irq_type = (idio24gpio->irq_type & ~mask) | (new & mask);
ret = regmap_read(idio24gpio->map, IDIO_24_COS_ENABLE, &cos_enable); if (ret) goto exit_unlock;
/* if COS is currently enabled then update the edge type */ if (cos_enable & mask) {
ret = regmap_update_bits(idio24gpio->map, IDIO_24_COS_ENABLE, mask,
idio24gpio->irq_type); if (ret) goto exit_unlock;
}
/* TTL/CMOS Inputs */
*reg = IDIO_24_TTLCMOS_IN_REG; return 0; case IDIO_24_CONTROL_REG: /* We can only set direction for TTL/CMOS lines */ if (offset < 48) return -ENOTSUPP;
*reg = IDIO_24_CONTROL_REG;
*mask = CONTROL_REG_OUT_MODE; return 0; default: /* Should never reach this path */ return -EINVAL;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.