1 // SPDX-License-Identifier: GPL-2.0-only
3 * platform_msic.c: MSIC platform data initialization file
5 * (C) Copyright 2013 Intel Corporation
6 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
9 #include <linux/kernel.h>
10 #include <linux/interrupt.h>
11 #include <linux/scatterlist.h>
12 #include <linux/init.h>
13 #include <linux/sfi.h>
14 #include <linux/mfd/intel_msic.h>
15 #include <asm/intel_scu_ipc.h>
16 #include <asm/intel-mid.h>
17 #include "platform_msic.h"
19 struct intel_msic_platform_data msic_pdata
;
21 static struct resource msic_resources
[] = {
23 .start
= INTEL_MSIC_IRQ_PHYS_BASE
,
24 .end
= INTEL_MSIC_IRQ_PHYS_BASE
+ 64 - 1,
25 .flags
= IORESOURCE_MEM
,
29 static struct platform_device msic_device
= {
33 .platform_data
= &msic_pdata
,
35 .num_resources
= ARRAY_SIZE(msic_resources
),
36 .resource
= msic_resources
,
39 static int msic_scu_status_change(struct notifier_block
*nb
,
40 unsigned long code
, void *data
)
42 if (code
== SCU_DOWN
) {
43 platform_device_unregister(&msic_device
);
47 return platform_device_register(&msic_device
);
50 static int __init
msic_init(void)
52 static struct notifier_block msic_scu_notifier
= {
53 .notifier_call
= msic_scu_status_change
,
57 * We need to be sure that the SCU IPC is ready before MSIC device
60 if (intel_mid_has_msic())
61 intel_scu_notifier_add(&msic_scu_notifier
);
65 arch_initcall(msic_init
);
68 * msic_generic_platform_data - sets generic platform data for the block
69 * @info: pointer to the SFI device table entry for this block
72 * Function sets IRQ number from the SFI table entry for given device to
73 * the MSIC platform data.
75 void *msic_generic_platform_data(void *info
, enum intel_msic_block block
)
77 struct sfi_device_table_entry
*entry
= info
;
79 BUG_ON(block
< 0 || block
>= INTEL_MSIC_BLOCK_LAST
);
80 msic_pdata
.irq
[block
] = entry
->irq
;