18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2007-2008 Freescale Semiconductor, Inc. All rights reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: Tony Li <tony.li@freescale.com>
68c2ecf20Sopenharmony_ci *	   Jason Jin <Jason.jin@freescale.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef _POWERPC_SYSDEV_FSL_MSI_H
98c2ecf20Sopenharmony_ci#define _POWERPC_SYSDEV_FSL_MSI_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/of.h>
128c2ecf20Sopenharmony_ci#include <asm/msi_bitmap.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define NR_MSI_REG_MSIIR	8  /* MSIIR can index 8 MSI registers */
158c2ecf20Sopenharmony_ci#define NR_MSI_REG_MSIIR1	16 /* MSIIR1 can index 16 MSI registers */
168c2ecf20Sopenharmony_ci#define NR_MSI_REG_MAX		NR_MSI_REG_MSIIR1
178c2ecf20Sopenharmony_ci#define IRQS_PER_MSI_REG	32
188c2ecf20Sopenharmony_ci#define NR_MSI_IRQS_MAX	(NR_MSI_REG_MAX * IRQS_PER_MSI_REG)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define FSL_PIC_IP_MASK   0x0000000F
218c2ecf20Sopenharmony_ci#define FSL_PIC_IP_MPIC   0x00000001
228c2ecf20Sopenharmony_ci#define FSL_PIC_IP_IPIC   0x00000002
238c2ecf20Sopenharmony_ci#define FSL_PIC_IP_VMPIC  0x00000003
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define MSI_HW_ERRATA_ENDIAN 0x00000010
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct fsl_msi_cascade_data;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistruct fsl_msi {
308c2ecf20Sopenharmony_ci	struct irq_domain *irqhost;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	unsigned long cascade_irq;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	u32 msiir_offset; /* Offset of MSIIR, relative to start of CCSR */
358c2ecf20Sopenharmony_ci	u32 ibs_shift; /* Shift of interrupt bit select */
368c2ecf20Sopenharmony_ci	u32 srs_shift; /* Shift of the shared interrupt register select */
378c2ecf20Sopenharmony_ci	void __iomem *msi_regs;
388c2ecf20Sopenharmony_ci	u32 feature;
398c2ecf20Sopenharmony_ci	struct fsl_msi_cascade_data *cascade_array[NR_MSI_REG_MAX];
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	struct msi_bitmap bitmap;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	struct list_head list;          /* support multiple MSI banks */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci	phandle phandle;
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#endif /* _POWERPC_SYSDEV_FSL_MSI_H */
498c2ecf20Sopenharmony_ci
50