2015-07-21 23:12:17 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-07-21 23:12:17 +08:00
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_
|
|
|
|
#define ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_
|
2016-11-15 19:39:35 +08:00
|
|
|
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2019-06-26 03:53:52 +08:00
|
|
|
#include <drivers/gpio.h>
|
2015-12-05 22:27:59 +08:00
|
|
|
#include "gpio_dw_registers.h"
|
2015-07-21 23:12:17 +08:00
|
|
|
|
2015-08-25 22:31:48 +08:00
|
|
|
#ifdef CONFIG_PCI
|
|
|
|
#include <pci/pci.h>
|
|
|
|
#include <pci/pci_mgr.h>
|
|
|
|
#endif /* CONFIG_PCI */
|
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-07-21 23:12:17 +08:00
|
|
|
typedef void (*gpio_config_irq_t)(struct device *port);
|
|
|
|
|
2015-11-02 07:13:41 +08:00
|
|
|
struct gpio_dw_config {
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t bits;
|
|
|
|
u32_t irq_num; /* set to 0 if GPIO port cannot interrupt */
|
2015-07-21 23:12:17 +08:00
|
|
|
gpio_config_irq_t config_func;
|
2015-09-29 06:15:45 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_GPIO_DW_SHARED_IRQ
|
|
|
|
char *shared_irq_dev_name;
|
|
|
|
#endif /* CONFIG_GPIO_DW_SHARED_IRQ */
|
2015-12-01 23:00:39 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_GPIO_DW_CLOCK_GATE
|
|
|
|
void *clock_data;
|
|
|
|
#endif
|
2015-07-21 23:12:17 +08:00
|
|
|
};
|
|
|
|
|
2015-11-02 07:13:41 +08:00
|
|
|
struct gpio_dw_runtime {
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t base_addr;
|
2016-10-11 06:20:26 +08:00
|
|
|
#ifdef CONFIG_PCI
|
|
|
|
struct pci_dev_info pci_dev;
|
|
|
|
#endif /* CONFIG_PCI */
|
|
|
|
|
2015-12-01 23:00:39 +08:00
|
|
|
#ifdef CONFIG_GPIO_DW_CLOCK_GATE
|
|
|
|
struct device *clock;
|
|
|
|
#endif
|
2016-03-23 19:01:06 +08:00
|
|
|
sys_slist_t callbacks;
|
2016-09-12 00:17:19 +08:00
|
|
|
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t device_power_state;
|
2016-09-12 00:17:19 +08:00
|
|
|
#endif
|
2015-07-21 23:12:17 +08:00
|
|
|
};
|
2016-01-23 01:38:49 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2016-11-15 19:39:35 +08:00
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_ */
|