2015-07-21 23:12:17 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-07-21 23:12:17 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-07-21 23:12:17 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-07-21 23:12:17 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <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 */
|
|
|
|
|
2015-11-02 07:13:41 +08:00
|
|
|
extern int gpio_dw_initialize(struct device *port);
|
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 {
|
2015-07-21 23:12:17 +08:00
|
|
|
uint32_t base_addr;
|
|
|
|
uint32_t bits;
|
|
|
|
uint32_t irq_num;
|
2015-08-25 22:31:48 +08:00
|
|
|
#ifdef CONFIG_PCI
|
|
|
|
struct pci_dev_info pci_dev;
|
|
|
|
#endif /* CONFIG_PCI */
|
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 {
|
2015-12-01 23:00:39 +08:00
|
|
|
#ifdef CONFIG_GPIO_DW_CLOCK_GATE
|
|
|
|
struct device *clock;
|
|
|
|
#endif
|
2015-07-21 23:12:17 +08:00
|
|
|
gpio_callback_t callback;
|
|
|
|
uint32_t enabled_callbacks;
|
|
|
|
uint8_t port_callback;
|
|
|
|
};
|