2 * platform_msic.c: MSIC platform data initilization file
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
13 #include <linux/kernel.h>
14 #include <linux/interrupt.h>
15 #include <linux/scatterlist.h>
16 #include <linux/init.h>
17 #include <linux/sfi.h>
18 #include <linux/mfd/intel_msic.h>
19 #include <asm/intel_scu_ipc.h>
20 #include <asm/intel-mid.h>
21 #include "platform_msic.h"
23 struct intel_msic_platform_data msic_pdata
;
25 static struct resource msic_resources
[] = {
27 .start
= INTEL_MSIC_IRQ_PHYS_BASE
,
28 .end
= INTEL_MSIC_IRQ_PHYS_BASE
+ 64 - 1,
29 .flags
= IORESOURCE_MEM
,
33 static struct platform_device msic_device
= {
37 .platform_data
= &msic_pdata
,
39 .num_resources
= ARRAY_SIZE(msic_resources
),
40 .resource
= msic_resources
,
43 static int msic_scu_status_change(struct notifier_block
*nb
,
44 unsigned long code
, void *data
)
46 if (code
== SCU_DOWN
) {
47 platform_device_unregister(&msic_device
);
51 return platform_device_register(&msic_device
);
54 static int __init
msic_init(void)
56 static struct notifier_block msic_scu_notifier
= {
57 .notifier_call
= msic_scu_status_change
,
61 * We need to be sure that the SCU IPC is ready before MSIC device
64 if (intel_mid_has_msic())
65 intel_scu_notifier_add(&msic_scu_notifier
);
69 arch_initcall(msic_init
);
72 * msic_generic_platform_data - sets generic platform data for the block
73 * @info: pointer to the SFI device table entry for this block
76 * Function sets IRQ number from the SFI table entry for given device to
77 * the MSIC platform data.
79 void *msic_generic_platform_data(void *info
, enum intel_msic_block block
)
81 struct sfi_device_table_entry
*entry
= info
;
83 BUG_ON(block
< 0 || block
>= INTEL_MSIC_BLOCK_LAST
);
84 msic_pdata
.irq
[block
] = entry
->irq
;