162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2007-2008 Freescale Semiconductor, Inc. All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Author: Tony Li <tony.li@freescale.com>
662306a36Sopenharmony_ci *	   Jason Jin <Jason.jin@freescale.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef _POWERPC_SYSDEV_FSL_MSI_H
962306a36Sopenharmony_ci#define _POWERPC_SYSDEV_FSL_MSI_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/of.h>
1262306a36Sopenharmony_ci#include <asm/msi_bitmap.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define NR_MSI_REG_MSIIR	8  /* MSIIR can index 8 MSI registers */
1562306a36Sopenharmony_ci#define NR_MSI_REG_MSIIR1	16 /* MSIIR1 can index 16 MSI registers */
1662306a36Sopenharmony_ci#define NR_MSI_REG_MAX		NR_MSI_REG_MSIIR1
1762306a36Sopenharmony_ci#define IRQS_PER_MSI_REG	32
1862306a36Sopenharmony_ci#define NR_MSI_IRQS_MAX	(NR_MSI_REG_MAX * IRQS_PER_MSI_REG)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define FSL_PIC_IP_MASK   0x0000000F
2162306a36Sopenharmony_ci#define FSL_PIC_IP_MPIC   0x00000001
2262306a36Sopenharmony_ci#define FSL_PIC_IP_IPIC   0x00000002
2362306a36Sopenharmony_ci#define FSL_PIC_IP_VMPIC  0x00000003
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define MSI_HW_ERRATA_ENDIAN 0x00000010
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistruct fsl_msi_cascade_data;
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cistruct fsl_msi {
3062306a36Sopenharmony_ci	struct irq_domain *irqhost;
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci	unsigned long cascade_irq;
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	u32 msiir_offset; /* Offset of MSIIR, relative to start of CCSR */
3562306a36Sopenharmony_ci	u32 ibs_shift; /* Shift of interrupt bit select */
3662306a36Sopenharmony_ci	u32 srs_shift; /* Shift of the shared interrupt register select */
3762306a36Sopenharmony_ci	void __iomem *msi_regs;
3862306a36Sopenharmony_ci	u32 feature;
3962306a36Sopenharmony_ci	struct fsl_msi_cascade_data *cascade_array[NR_MSI_REG_MAX];
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	struct msi_bitmap bitmap;
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci	struct list_head list;          /* support multiple MSI banks */
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci	phandle phandle;
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#endif /* _POWERPC_SYSDEV_FSL_MSI_H */
4962306a36Sopenharmony_ci
50