// SPDX-License-Identifier: GPL-2.0-only1/*2* First-level interrupt controller model for Hexagon.3*4* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.5*/67#include <linux/interrupt.h>8#include <asm/irq.h>9#include <asm/hexagon_vm.h>1011static void mask_irq(struct irq_data *data)12{13__vmintop_locdis((long) data->irq);14}1516static void mask_irq_num(unsigned int irq)17{18__vmintop_locdis((long) irq);19}2021static void unmask_irq(struct irq_data *data)22{23__vmintop_locen((long) data->irq);24}2526/* This is actually all we need for handle_fasteoi_irq */27static void eoi_irq(struct irq_data *data)28{29__vmintop_globen((long) data->irq);30}3132/* Power mamangement wake call. We don't need this, however,33* if this is absent, then an -ENXIO error is returned to the34* msm_serial driver, and it fails to correctly initialize.35* This is a bug in the msm_serial driver, but, for now, we36* work around it here, by providing this bogus handler.37* XXX FIXME!!! remove this when msm_serial is fixed.38*/39static int set_wake(struct irq_data *data, unsigned int on)40{41return 0;42}4344static struct irq_chip hexagon_irq_chip = {45.name = "HEXAGON",46.irq_mask = mask_irq,47.irq_unmask = unmask_irq,48.irq_set_wake = set_wake,49.irq_eoi = eoi_irq50};5152/**53* The hexagon core comes with a first-level interrupt controller54* with 32 total possible interrupts. When the core is embedded55* into different systems/platforms, it is typically wrapped by56* macro cells that provide one or more second-level interrupt57* controllers that are cascaded into one or more of the first-level58* interrupts handled here. The precise wiring of these other59* irqs varies from platform to platform, and are set up & configured60* in the platform-specific files.61*62* The first-level interrupt controller is wrapped by the VM, which63* virtualizes the interrupt controller for us. It provides a very64* simple, fast & efficient API, and so the fasteoi handler is65* appropriate for this case.66*/67void __init init_IRQ(void)68{69int irq;7071for (irq = 0; irq < HEXAGON_CPUINTS; irq++) {72mask_irq_num(irq);73irq_set_chip_and_handler(irq, &hexagon_irq_chip,74handle_fasteoi_irq);75}76}777879