1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * platform_msic_gpio.c: MSIC GPIO platform data initialization file
4  *
5  * (C) Copyright 2013 Intel Corporation
6  * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
7  */
8 
9 #include <linux/kernel.h>
10 #include <linux/interrupt.h>
11 #include <linux/scatterlist.h>
12 #include <linux/sfi.h>
13 #include <linux/init.h>
14 #include <linux/gpio.h>
15 #include <linux/mfd/intel_msic.h>
16 #include <asm/intel-mid.h>
17 
18 #include "platform_msic.h"
19 
msic_gpio_platform_data(void * info)20 static void __init *msic_gpio_platform_data(void *info)
21 {
22 	static struct intel_msic_gpio_pdata msic_gpio_pdata;
23 
24 	int gpio = get_gpio_by_name("msic_gpio_base");
25 
26 	if (gpio < 0)
27 		return NULL;
28 
29 	msic_gpio_pdata.gpio_base = gpio;
30 	msic_pdata.gpio = &msic_gpio_pdata;
31 
32 	return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_GPIO);
33 }
34 
35 static const struct devs_id msic_gpio_dev_id __initconst = {
36 	.name = "msic_gpio",
37 	.type = SFI_DEV_TYPE_IPC,
38 	.delay = 1,
39 	.msic = 1,
40 	.get_platform_data = &msic_gpio_platform_data,
41 };
42 
43 sfi_device(msic_gpio_dev_id);
44