#include <linux/device.h>
#include <linux/pci.h>
#include <linux/slab.h>
-
-
-#include <linux/uio_driver.h>
#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/uio_driver.h>
#define PCI_VENDOR_ID_HUMUSOFT 0x186c
#define PCI_DEVICE_ID_MF614 0x0614
#define PCI_SUBVENDOR_ID_HUMUSOFT 0x186c
#define PCI_SUBDEVICE_DEVICE 0x0000
-#define STATUS_OFFSET 0x10
+#define STATUS_REG 0x10
#define STATUS_T5INTE (u32) (1 << 19)
#define STATUS_T5 (u32) (1 << 3)
#define STATUS_CCINTE (u32) (1 << 18)
static irqreturn_t mf614_irq_handler(int irq, struct uio_info *info)
{
- void __iomem *status_reg = info->priv + STATUS_OFFSET;
+ void __iomem *status_reg = info->priv;
+ status_reg = ((u8*) status_reg) + STATUS_REG;
+
- if ((ioread16(status_reg) & STATUS_T5INTE)
- && (ioread16(status_reg) & STATUS_T5))
+ if ((ioread32(status_reg) & STATUS_T5INTE)
+ && (ioread32(status_reg) & STATUS_T5))
{
- iowrite16(ioread16(status_reg) & ~STATUS_T5INTE, status_reg);
+ //disable interrupt
+ iowrite32(ioread16(status_reg) & ~STATUS_T5INTE, status_reg);
return IRQ_HANDLED;
}
- if ((ioread16(status_reg) & STATUS_CCINTE)
- && (ioread16(status_reg) & STATUS_CC))
+ if ((ioread32(status_reg) & STATUS_CCINTE)
+ && (ioread32(status_reg) & STATUS_CC))
{
- iowrite16(ioread16(status_reg) & ~STATUS_CCINTE, status_reg);
+ //disable interrupt
+ iowrite32(ioread32(status_reg) & ~STATUS_CCINTE, status_reg);
return IRQ_HANDLED;
}
static int mf614_irqcontrol(struct uio_info *info, s32 irq_on)
{
- void __iomem *status_reg = info->priv + STATUS_OFFSET;
+ void __iomem *status_reg = info->priv;
+ status_reg = ((u8*) status_reg) + STATUS_REG;
+
if (irq_on == 0) { /* Disable interrupts */
- iowrite16(ioread16(status_reg) & ~STATUS_T5INTE, status_reg);
- iowrite16(ioread16(status_reg) & ~STATUS_CCINTE, status_reg);
+ iowrite32(ioread32(status_reg) & ~STATUS_T5INTE, status_reg);
+ iowrite32(ioread32(status_reg) & ~STATUS_CCINTE, status_reg);
}
else if (irq_on == 1) {
- iowrite16(ioread16(status_reg) | STATUS_T5INTE, status_reg);
- iowrite16(ioread16(status_reg) | STATUS_CCINTE, status_reg);
+ iowrite32(ioread32(status_reg) | STATUS_T5INTE, status_reg);
+ iowrite32(ioread32(status_reg) | STATUS_CCINTE, status_reg);
}
return 0;
static void mf614_pci_remove(struct pci_dev *dev)
{
struct uio_info *info = pci_get_drvdata(dev);
- void __iomem *status_reg = info->priv + STATUS_OFFSET;
+ void __iomem *status_reg = info->priv;
+ status_reg = ((u8*) status_reg) + STATUS_REG;
/* Disable interrupts */
- iowrite16(ioread16(status_reg) & ~STATUS_T5INTE, status_reg);
- iowrite16(ioread16(status_reg) & ~STATUS_CCINTE, status_reg);
+ iowrite32(ioread32(status_reg) & ~STATUS_T5INTE, status_reg);
+ iowrite32(ioread32(status_reg) & ~STATUS_CCINTE, status_reg);
uio_unregister_device(info);
pci_release_regions(dev);