18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * drivers/parisc/gsc.h
48c2ecf20Sopenharmony_ci * Declarations for functions in gsc.c
58c2ecf20Sopenharmony_ci * Copyright (c) 2000-2002 Helge Deller, Matthew Wilcox
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
98c2ecf20Sopenharmony_ci#include <asm/hardware.h>
108c2ecf20Sopenharmony_ci#include <asm/parisc-device.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define OFFSET_IRR 0x0000   /* Interrupt request register */
138c2ecf20Sopenharmony_ci#define OFFSET_IMR 0x0004   /* Interrupt mask register */
148c2ecf20Sopenharmony_ci#define OFFSET_IPR 0x0008   /* Interrupt pending register */
158c2ecf20Sopenharmony_ci#define OFFSET_ICR 0x000C   /* Interrupt control register */
168c2ecf20Sopenharmony_ci#define OFFSET_IAR 0x0010   /* Interrupt address register */
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* PA I/O Architected devices support at least 5 bits in the EIM register. */
198c2ecf20Sopenharmony_ci#define GSC_EIM_WIDTH 5
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct gsc_irq {
228c2ecf20Sopenharmony_ci	unsigned long txn_addr;	/* IRQ "target" */
238c2ecf20Sopenharmony_ci	int txn_data;		/* HW "IRQ" */
248c2ecf20Sopenharmony_ci	int irq;		/* virtual IRQ */
258c2ecf20Sopenharmony_ci};
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct gsc_asic {
288c2ecf20Sopenharmony_ci	struct parisc_device *gsc;
298c2ecf20Sopenharmony_ci	unsigned long hpa;
308c2ecf20Sopenharmony_ci	char *name;
318c2ecf20Sopenharmony_ci	int version;
328c2ecf20Sopenharmony_ci	int type;
338c2ecf20Sopenharmony_ci	int eim;
348c2ecf20Sopenharmony_ci	struct gsc_irq gsc_irq;
358c2ecf20Sopenharmony_ci	int global_irq[32];
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciint gsc_common_setup(struct parisc_device *parent, struct gsc_asic *gsc_asic);
398c2ecf20Sopenharmony_ciint gsc_alloc_irq(struct gsc_irq *dev);			/* dev needs an irq */
408c2ecf20Sopenharmony_ciint gsc_claim_irq(struct gsc_irq *dev, int irq);	/* dev needs this irq */
418c2ecf20Sopenharmony_ciint gsc_assign_irq(struct irq_chip *type, void *data);
428c2ecf20Sopenharmony_ciint gsc_find_local_irq(unsigned int irq, int *global_irq, int limit);
438c2ecf20Sopenharmony_civoid gsc_fixup_irqs(struct parisc_device *parent, void *ctrl,
448c2ecf20Sopenharmony_ci		void (*choose)(struct parisc_device *child, void *ctrl));
458c2ecf20Sopenharmony_civoid gsc_asic_assign_irq(struct gsc_asic *asic, int local_irq, int *irqp);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciirqreturn_t gsc_asic_intr(int irq, void *dev);
48