Lines Matching +full:straight +full:- +full:forward
1 // SPDX-License-Identifier: GPL-2.0
7 This is a straight-forward UIO driver, where interrupts are disabled
8 by the interrupt handler and re-enabled via a write to the UIO device
9 by the userspace-part.
13 userspace-part could directly modify the Interrupt Enable Register
18 Race conditions exist if the userspace-part directly modifies the
21 this reason, the userspace-part should only directly modify the
23 The userspace-part can safely disable interrupts at any time using
55 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET; in sercos3_disable_interrupts()
58 priv->ier0_cache |= ioread32(ier0); in sercos3_disable_interrupts()
68 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET; in sercos3_enable_interrupts()
71 iowrite32(ioread32(ier0) | priv->ier0_cache, ier0); in sercos3_enable_interrupts()
72 priv->ier0_cache = 0; in sercos3_enable_interrupts()
77 struct sercos3_priv *priv = info->priv; in sercos3_handler()
78 void __iomem *isr0 = info->mem[3].internal_addr + ISR0_OFFSET; in sercos3_handler()
79 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET; in sercos3_handler()
84 spin_lock(&priv->ier0_cache_lock); in sercos3_handler()
86 spin_unlock(&priv->ier0_cache_lock); in sercos3_handler()
93 struct sercos3_priv *priv = info->priv; in sercos3_irqcontrol()
95 spin_lock_irq(&priv->ier0_cache_lock); in sercos3_irqcontrol()
100 spin_unlock_irq(&priv->ier0_cache_lock); in sercos3_irqcontrol()
108 info->mem[n].addr = pci_resource_start(dev, pci_bar); in sercos3_setup_iomem()
109 if (!info->mem[n].addr) in sercos3_setup_iomem()
110 return -1; in sercos3_setup_iomem()
111 info->mem[n].internal_addr = ioremap(pci_resource_start(dev, pci_bar), in sercos3_setup_iomem()
113 if (!info->mem[n].internal_addr) in sercos3_setup_iomem()
114 return -1; in sercos3_setup_iomem()
115 info->mem[n].size = pci_resource_len(dev, pci_bar); in sercos3_setup_iomem()
116 info->mem[n].memtype = UIO_MEM_PHYS; in sercos3_setup_iomem()
127 info = devm_kzalloc(&dev->dev, sizeof(struct uio_info), GFP_KERNEL); in sercos3_pci_probe()
129 return -ENOMEM; in sercos3_pci_probe()
131 priv = devm_kzalloc(&dev->dev, sizeof(struct sercos3_priv), GFP_KERNEL); in sercos3_pci_probe()
133 return -ENOMEM; in sercos3_pci_probe()
136 return -ENODEV; in sercos3_pci_probe()
153 spin_lock_init(&priv->ier0_cache_lock); in sercos3_pci_probe()
154 info->priv = priv; in sercos3_pci_probe()
155 info->name = "Sercos_III_PCI"; in sercos3_pci_probe()
156 info->version = "0.0.1"; in sercos3_pci_probe()
157 info->irq = dev->irq; in sercos3_pci_probe()
158 info->irq_flags = IRQF_SHARED; in sercos3_pci_probe()
159 info->handler = sercos3_handler; in sercos3_pci_probe()
160 info->irqcontrol = sercos3_irqcontrol; in sercos3_pci_probe()
164 if (uio_register_device(&dev->dev, info)) in sercos3_pci_probe()
171 if (info->mem[i].internal_addr) in sercos3_pci_probe()
172 iounmap(info->mem[i].internal_addr); in sercos3_pci_probe()
177 return -ENODEV; in sercos3_pci_probe()
189 if (info->mem[i].internal_addr) in sercos3_pci_remove()
190 iounmap(info->mem[i].internal_addr); in sercos3_pci_remove()