1/*
2 * platform_pmic_gpio.c: PMIC GPIO platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
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
10 * of the License.
11 */
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/scatterlist.h>
16#include <linux/gpio.h>
17#include <linux/init.h>
18#include <linux/sfi.h>
19#include <linux/intel_pmic_gpio.h>
20#include <asm/intel-mid.h>
21
22#include "platform_ipc.h"
23
24static void __init *pmic_gpio_platform_data(void *info)
25{
26	static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
27	int gpio_base = get_gpio_by_name("pmic_gpio_base");
28
29	if (gpio_base < 0)
30		gpio_base = 64;
31	pmic_gpio_pdata.gpio_base = gpio_base;
32	pmic_gpio_pdata.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
33	pmic_gpio_pdata.gpiointr = 0xffffeff8;
34
35	return &pmic_gpio_pdata;
36}
37
38static const struct devs_id pmic_gpio_spi_dev_id __initconst = {
39	.name = "pmic_gpio",
40	.type = SFI_DEV_TYPE_SPI,
41	.delay = 1,
42	.get_platform_data = &pmic_gpio_platform_data,
43};
44
45static const struct devs_id pmic_gpio_ipc_dev_id __initconst = {
46	.name = "pmic_gpio",
47	.type = SFI_DEV_TYPE_IPC,
48	.delay = 1,
49	.get_platform_data = &pmic_gpio_platform_data,
50	.device_handler = &ipc_device_handler
51};
52
53sfi_device(pmic_gpio_spi_dev_id);
54sfi_device(pmic_gpio_ipc_dev_id);
55