1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Intel Tangier GPIO functions
5 * Copyright (c) 2016, 2021, 2023 Intel Corporation.
7 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
8 * Pandith N <pandith.n@intel.com>
9 * Raag Jadav <raag.jadav@intel.com>
12 #ifndef _GPIO_TANGIER_H_
13 #define _GPIO_TANGIER_H_
15 #include <linux/gpio/driver.h>
17 #include <linux/spinlock_types.h>
18 #include <linux/types.h>
22 struct tng_gpio_context
;
24 /* Elkhart Lake specific wake registers */
25 #define GWMR_EHL 0x100 /* Wake mask */
26 #define GWSR_EHL 0x118 /* Wake source */
27 #define GSIR_EHL 0x130 /* Secure input */
29 /* Merrifield specific wake registers */
30 #define GWMR_MRFLD 0x400 /* Wake mask */
31 #define GWSR_MRFLD 0x418 /* Wake source */
32 #define GSIR_MRFLD 0xc00 /* Secure input */
35 * struct tng_wake_regs - Platform specific wake registers
40 struct tng_wake_regs
{
47 * struct tng_gpio_pinrange - Map pin numbers to gpio numbers
48 * @gpio_base: Starting GPIO number of this range
49 * @pin_base: Starting pin number of this range
50 * @npins: Number of pins in this range
52 struct tng_gpio_pinrange
{
53 unsigned int gpio_base
;
54 unsigned int pin_base
;
58 #define GPIO_PINRANGE(gstart, gend, pstart) \
59 (struct tng_gpio_pinrange) { \
60 .gpio_base = (gstart), \
61 .pin_base = (pstart), \
62 .npins = (gend) - (gstart) + 1, \
66 * struct tng_gpio_pin_info - Platform specific pinout information
67 * @pin_ranges: Pin to GPIO mapping
68 * @nranges: Number of pin ranges
69 * @name: Respective pinctrl device name
71 struct tng_gpio_pin_info
{
72 const struct tng_gpio_pinrange
*pin_ranges
;
78 * struct tng_gpio_info - Platform specific GPIO and IRQ information
79 * @base: GPIO base to start numbering with
80 * @ngpio: Amount of GPIOs supported by the controller
81 * @first: First IRQ to start numbering with
83 struct tng_gpio_info
{
90 * struct tng_gpio - Platform specific private data
91 * @chip: Instance of the struct gpio_chip
92 * @reg_base: Base address of MMIO registers
93 * @irq: Interrupt for the GPIO device
94 * @lock: Synchronization lock to prevent I/O race conditions
95 * @dev: The GPIO device
96 * @ctx: Context to be saved during suspend-resume
97 * @wake_regs: Platform specific wake registers
98 * @pin_info: Platform specific pinout information
99 * @info: Platform specific GPIO and IRQ information
102 struct gpio_chip chip
;
103 void __iomem
*reg_base
;
107 struct tng_gpio_context
*ctx
;
108 struct tng_wake_regs wake_regs
;
109 struct tng_gpio_pin_info pin_info
;
110 struct tng_gpio_info info
;
113 int devm_tng_gpio_probe(struct device
*dev
, struct tng_gpio
*gpio
);
115 extern const struct dev_pm_ops tng_gpio_pm_ops
;
117 #endif /* _GPIO_TANGIER_H_ */