Commit 9409d8cf authored by Pandith N's avatar Pandith N Committed by Andy Shevchenko

gpio: elkhartlake: Introduce Intel Elkhart Lake PSE GPIO

This driver adds support for Intel Elkhart Lake PSE GPIO controller,
using Intel Tangier as a library driver.
Signed-off-by: default avatarPandith N <pandith.n@intel.com>
Co-developed-by: default avatarRaag Jadav <raag.jadav@intel.com>
Signed-off-by: default avatarRaag Jadav <raag.jadav@intel.com>
Co-developed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent dc537030
...@@ -10281,6 +10281,7 @@ M: Andy Shevchenko <andy@kernel.org> ...@@ -10281,6 +10281,7 @@ M: Andy Shevchenko <andy@kernel.org>
L: linux-gpio@vger.kernel.org L: linux-gpio@vger.kernel.org
S: Supported S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git
F: drivers/gpio/gpio-elkhartlake.c
F: drivers/gpio/gpio-ich.c F: drivers/gpio/gpio-ich.c
F: drivers/gpio/gpio-merrifield.c F: drivers/gpio/gpio-merrifield.c
F: drivers/gpio/gpio-ml-ioh.c F: drivers/gpio/gpio-ml-ioh.c
......
...@@ -625,6 +625,7 @@ config GPIO_TANGIER ...@@ -625,6 +625,7 @@ config GPIO_TANGIER
help help
GPIO support for Intel Tangier and compatible platforms. GPIO support for Intel Tangier and compatible platforms.
Currently supported: Currently supported:
- Elkhart Lake
- Merrifield - Merrifield
If built as a module its name will be gpio-tangier. If built as a module its name will be gpio-tangier.
...@@ -1248,6 +1249,17 @@ config HTC_EGPIO ...@@ -1248,6 +1249,17 @@ config HTC_EGPIO
several HTC phones. It provides basic support for input several HTC phones. It provides basic support for input
pins, output pins, and IRQs. pins, output pins, and IRQs.
config GPIO_ELKHARTLAKE
tristate "Intel Elkhart Lake PSE GPIO support"
depends on X86 || COMPILE_TEST
select GPIO_TANGIER
help
Select this option to enable GPIO support for Intel Elkhart Lake
PSE GPIO IP.
To compile this driver as a module, choose M here: the module will
be called gpio-elkhartlake.
config GPIO_JANZ_TTL config GPIO_JANZ_TTL
tristate "Janz VMOD-TTL Digital IO Module" tristate "Janz VMOD-TTL Digital IO Module"
depends on MFD_JANZ_CMODIO depends on MFD_JANZ_CMODIO
......
...@@ -54,6 +54,7 @@ obj-$(CONFIG_GPIO_DAVINCI) += gpio-davinci.o ...@@ -54,6 +54,7 @@ obj-$(CONFIG_GPIO_DAVINCI) += gpio-davinci.o
obj-$(CONFIG_GPIO_DLN2) += gpio-dln2.o obj-$(CONFIG_GPIO_DLN2) += gpio-dln2.o
obj-$(CONFIG_GPIO_DWAPB) += gpio-dwapb.o obj-$(CONFIG_GPIO_DWAPB) += gpio-dwapb.o
obj-$(CONFIG_GPIO_EIC_SPRD) += gpio-eic-sprd.o obj-$(CONFIG_GPIO_EIC_SPRD) += gpio-eic-sprd.o
obj-$(CONFIG_GPIO_ELKHARTLAKE) += gpio-elkhartlake.o
obj-$(CONFIG_GPIO_EM) += gpio-em.o obj-$(CONFIG_GPIO_EM) += gpio-em.o
obj-$(CONFIG_GPIO_EN7523) += gpio-en7523.o obj-$(CONFIG_GPIO_EN7523) += gpio-en7523.o
obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o
......
// SPDX-License-Identifier: GPL-2.0-only
/*
* Intel Elkhart Lake PSE GPIO driver
*
* Copyright (c) 2023 Intel Corporation.
*
* Authors: Pandith N <pandith.n@intel.com>
* Raag Jadav <raag.jadav@intel.com>
*/
#include <linux/device.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include "gpio-tangier.h"
/* Each Intel EHL PSE GPIO Controller has 30 GPIO pins */
#define EHL_PSE_NGPIO 30
static int ehl_gpio_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct tng_gpio *priv;
int irq, ret;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->reg_base))
return PTR_ERR(priv->reg_base);
priv->dev = dev;
priv->irq = irq;
priv->info.base = -1;
priv->info.ngpio = EHL_PSE_NGPIO;
priv->wake_regs.gwmr = GWMR_EHL;
priv->wake_regs.gwsr = GWSR_EHL;
priv->wake_regs.gsir = GSIR_EHL;
ret = devm_tng_gpio_probe(dev, priv);
if (ret)
return dev_err_probe(dev, ret, "tng_gpio_probe error\n");
platform_set_drvdata(pdev, priv);
return 0;
}
static int ehl_gpio_suspend(struct device *dev)
{
return tng_gpio_suspend(dev);
}
static int ehl_gpio_resume(struct device *dev)
{
return tng_gpio_resume(dev);
}
static DEFINE_SIMPLE_DEV_PM_OPS(ehl_gpio_pm_ops, ehl_gpio_suspend, ehl_gpio_resume);
static const struct platform_device_id ehl_gpio_ids[] = {
{ "gpio-elkhartlake" },
{ }
};
MODULE_DEVICE_TABLE(platform, ehl_gpio_ids);
static struct platform_driver ehl_gpio_driver = {
.driver = {
.name = "gpio-elkhartlake",
.pm = pm_sleep_ptr(&ehl_gpio_pm_ops),
},
.probe = ehl_gpio_probe,
.id_table = ehl_gpio_ids,
};
module_platform_driver(ehl_gpio_driver);
MODULE_AUTHOR("Pandith N <pandith.n@intel.com>");
MODULE_AUTHOR("Raag Jadav <raag.jadav@intel.com>");
MODULE_DESCRIPTION("Intel Elkhart Lake PSE GPIO driver");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(GPIO_TANGIER);
...@@ -20,6 +20,11 @@ struct device; ...@@ -20,6 +20,11 @@ struct device;
struct tng_gpio_context; struct tng_gpio_context;
/* Elkhart Lake specific wake registers */
#define GWMR_EHL 0x100 /* Wake mask */
#define GWSR_EHL 0x118 /* Wake source */
#define GSIR_EHL 0x130 /* Secure input */
/* Merrifield specific wake registers */ /* Merrifield specific wake registers */
#define GWMR_MRFLD 0x400 /* Wake mask */ #define GWMR_MRFLD 0x400 /* Wake mask */
#define GWSR_MRFLD 0x418 /* Wake source */ #define GWSR_MRFLD 0x418 /* Wake source */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment