~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mn10300/unit-asb2364/irq-fpga.c

Version: ~ [ linux-5.11-rc3 ] ~ [ linux-5.10.7 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.89 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.167 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.215 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.251 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.251 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* ASB2364 FPGA interrupt multiplexing
  2  *
  3  * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved.
  4  * Written by David Howells (dhowells@redhat.com)
  5  *
  6  * This program is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU General Public Licence
  8  * as published by the Free Software Foundation; either version
  9  * 2 of the Licence, or (at your option) any later version.
 10  */
 11 
 12 #include <linux/interrupt.h>
 13 #include <linux/init.h>
 14 #include <linux/irq.h>
 15 #include <unit/fpga-regs.h>
 16 
 17 /*
 18  * FPGA PIC operations
 19  */
 20 static void asb2364_fpga_mask(struct irq_data *d)
 21 {
 22         ASB2364_FPGA_REG_MASK(d->irq - NR_CPU_IRQS) = 0x0001;
 23         SyncExBus();
 24 }
 25 
 26 static void asb2364_fpga_ack(struct irq_data *d)
 27 {
 28         ASB2364_FPGA_REG_IRQ(d->irq - NR_CPU_IRQS) = 0x0001;
 29         SyncExBus();
 30 }
 31 
 32 static void asb2364_fpga_mask_ack(struct irq_data *d)
 33 {
 34         ASB2364_FPGA_REG_MASK(d->irq - NR_CPU_IRQS) = 0x0001;
 35         SyncExBus();
 36         ASB2364_FPGA_REG_IRQ(d->irq - NR_CPU_IRQS) = 0x0001;
 37         SyncExBus();
 38 }
 39 
 40 static void asb2364_fpga_unmask(struct irq_data *d)
 41 {
 42         ASB2364_FPGA_REG_MASK(d->irq - NR_CPU_IRQS) = 0x0000;
 43         SyncExBus();
 44 }
 45 
 46 static struct irq_chip asb2364_fpga_pic = {
 47         .name           = "fpga",
 48         .irq_ack        = asb2364_fpga_ack,
 49         .irq_mask       = asb2364_fpga_mask,
 50         .irq_mask_ack   = asb2364_fpga_mask_ack,
 51         .irq_unmask     = asb2364_fpga_unmask,
 52 };
 53 
 54 /*
 55  * FPGA PIC interrupt handler
 56  */
 57 static irqreturn_t fpga_interrupt(int irq, void *_mask)
 58 {
 59         if ((ASB2364_FPGA_REG_IRQ_LAN  & 0x0001) != 0x0001)
 60                 generic_handle_irq(FPGA_LAN_IRQ);
 61         if ((ASB2364_FPGA_REG_IRQ_UART & 0x0001) != 0x0001)
 62                 generic_handle_irq(FPGA_UART_IRQ);
 63         if ((ASB2364_FPGA_REG_IRQ_I2C  & 0x0001) != 0x0001)
 64                 generic_handle_irq(FPGA_I2C_IRQ);
 65         if ((ASB2364_FPGA_REG_IRQ_USB  & 0x0001) != 0x0001)
 66                 generic_handle_irq(FPGA_USB_IRQ);
 67         if ((ASB2364_FPGA_REG_IRQ_FPGA & 0x0001) != 0x0001)
 68                 generic_handle_irq(FPGA_FPGA_IRQ);
 69 
 70         return IRQ_HANDLED;
 71 }
 72 
 73 /*
 74  * Define an interrupt action for each FPGA PIC output
 75  */
 76 static struct irqaction fpga_irq[]  = {
 77         [0] = {
 78                 .handler        = fpga_interrupt,
 79                 .flags          = IRQF_SHARED,
 80                 .name           = "fpga",
 81         },
 82 };
 83 
 84 /*
 85  * Initialise the FPGA's PIC
 86  */
 87 void __init irq_fpga_init(void)
 88 {
 89         int irq;
 90 
 91         ASB2364_FPGA_REG_MASK_LAN  = 0x0001;
 92         SyncExBus();
 93         ASB2364_FPGA_REG_MASK_UART = 0x0001;
 94         SyncExBus();
 95         ASB2364_FPGA_REG_MASK_I2C  = 0x0001;
 96         SyncExBus();
 97         ASB2364_FPGA_REG_MASK_USB  = 0x0001;
 98         SyncExBus();
 99         ASB2364_FPGA_REG_MASK_FPGA = 0x0001;
100         SyncExBus();
101 
102         for (irq = NR_CPU_IRQS; irq < NR_IRQS; irq++)
103                 irq_set_chip_and_handler(irq, &asb2364_fpga_pic,
104                                          handle_level_irq);
105 
106         /* the FPGA drives the XIRQ1 input on the CPU PIC */
107         setup_irq(XIRQ1, &fpga_irq[0]);
108 }
109 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp