162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * IPIC external definitions and structure.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Maintainer: Kumar Gala <galak@kernel.crashing.org>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright 2005 Freescale Semiconductor, Inc
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#ifdef __KERNEL__
1062306a36Sopenharmony_ci#ifndef __ASM_IPIC_H__
1162306a36Sopenharmony_ci#define __ASM_IPIC_H__
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/irq.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* Flags when we init the IPIC */
1662306a36Sopenharmony_ci#define IPIC_SPREADMODE_GRP_A	0x00000001
1762306a36Sopenharmony_ci#define IPIC_SPREADMODE_GRP_B	0x00000002
1862306a36Sopenharmony_ci#define IPIC_SPREADMODE_GRP_C	0x00000004
1962306a36Sopenharmony_ci#define IPIC_SPREADMODE_GRP_D	0x00000008
2062306a36Sopenharmony_ci#define IPIC_SPREADMODE_MIX_A	0x00000010
2162306a36Sopenharmony_ci#define IPIC_SPREADMODE_MIX_B	0x00000020
2262306a36Sopenharmony_ci#define IPIC_DISABLE_MCP_OUT	0x00000040
2362306a36Sopenharmony_ci#define IPIC_IRQ0_MCP		0x00000080
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci/* IPIC registers offsets */
2662306a36Sopenharmony_ci#define IPIC_SICFR	0x00	/* System Global Interrupt Configuration Register */
2762306a36Sopenharmony_ci#define IPIC_SIVCR	0x04	/* System Global Interrupt Vector Register */
2862306a36Sopenharmony_ci#define IPIC_SIPNR_H	0x08	/* System Internal Interrupt Pending Register (HIGH) */
2962306a36Sopenharmony_ci#define IPIC_SIPNR_L	0x0C	/* System Internal Interrupt Pending Register (LOW) */
3062306a36Sopenharmony_ci#define IPIC_SIPRR_A	0x10	/* System Internal Interrupt group A Priority Register */
3162306a36Sopenharmony_ci#define IPIC_SIPRR_B	0x14	/* System Internal Interrupt group B Priority Register */
3262306a36Sopenharmony_ci#define IPIC_SIPRR_C	0x18	/* System Internal Interrupt group C Priority Register */
3362306a36Sopenharmony_ci#define IPIC_SIPRR_D	0x1C	/* System Internal Interrupt group D Priority Register */
3462306a36Sopenharmony_ci#define IPIC_SIMSR_H	0x20	/* System Internal Interrupt Mask Register (HIGH) */
3562306a36Sopenharmony_ci#define IPIC_SIMSR_L	0x24	/* System Internal Interrupt Mask Register (LOW) */
3662306a36Sopenharmony_ci#define IPIC_SICNR	0x28	/* System Internal Interrupt Control Register */
3762306a36Sopenharmony_ci#define IPIC_SEPNR	0x2C	/* System External Interrupt Pending Register */
3862306a36Sopenharmony_ci#define IPIC_SMPRR_A	0x30	/* System Mixed Interrupt group A Priority Register */
3962306a36Sopenharmony_ci#define IPIC_SMPRR_B	0x34	/* System Mixed Interrupt group B Priority Register */
4062306a36Sopenharmony_ci#define IPIC_SEMSR	0x38	/* System External Interrupt Mask Register */
4162306a36Sopenharmony_ci#define IPIC_SECNR	0x3C	/* System External Interrupt Control Register */
4262306a36Sopenharmony_ci#define IPIC_SERSR	0x40	/* System Error Status Register */
4362306a36Sopenharmony_ci#define IPIC_SERMR	0x44	/* System Error Mask Register */
4462306a36Sopenharmony_ci#define IPIC_SERCR	0x48	/* System Error Control Register */
4562306a36Sopenharmony_ci#define IPIC_SIFCR_H	0x50	/* System Internal Interrupt Force Register (HIGH) */
4662306a36Sopenharmony_ci#define IPIC_SIFCR_L	0x54	/* System Internal Interrupt Force Register (LOW) */
4762306a36Sopenharmony_ci#define IPIC_SEFCR	0x58	/* System External Interrupt Force Register */
4862306a36Sopenharmony_ci#define IPIC_SERFR	0x5C	/* System Error Force Register */
4962306a36Sopenharmony_ci#define IPIC_SCVCR	0x60	/* System Critical Interrupt Vector Register */
5062306a36Sopenharmony_ci#define IPIC_SMVCR	0x64	/* System Management Interrupt Vector Register */
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_cienum ipic_prio_grp {
5362306a36Sopenharmony_ci	IPIC_INT_GRP_A = IPIC_SIPRR_A,
5462306a36Sopenharmony_ci	IPIC_INT_GRP_D = IPIC_SIPRR_D,
5562306a36Sopenharmony_ci	IPIC_MIX_GRP_A = IPIC_SMPRR_A,
5662306a36Sopenharmony_ci	IPIC_MIX_GRP_B = IPIC_SMPRR_B,
5762306a36Sopenharmony_ci};
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_cienum ipic_mcp_irq {
6062306a36Sopenharmony_ci	IPIC_MCP_IRQ0 = 0,
6162306a36Sopenharmony_ci	IPIC_MCP_WDT  = 1,
6262306a36Sopenharmony_ci	IPIC_MCP_SBA  = 2,
6362306a36Sopenharmony_ci	IPIC_MCP_PCI1 = 5,
6462306a36Sopenharmony_ci	IPIC_MCP_PCI2 = 6,
6562306a36Sopenharmony_ci	IPIC_MCP_MU   = 7,
6662306a36Sopenharmony_ci};
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_civoid __init ipic_set_default_priority(void);
6962306a36Sopenharmony_ciextern u32 ipic_get_mcp_status(void);
7062306a36Sopenharmony_ciextern void ipic_clear_mcp_status(u32 mask);
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciextern struct ipic * ipic_init(struct device_node *node, unsigned int flags);
7362306a36Sopenharmony_ciextern unsigned int ipic_get_irq(void);
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#endif /* __ASM_IPIC_H__ */
7662306a36Sopenharmony_ci#endif /* __KERNEL__ */
77