blob: 54aecc9b76d81e01a9184f8f4ede0d5ac3ef277e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2026 Beckhoff Automation GmbH & Co. KG
*/
#ifndef _DEV_GPIO_INTEL_INTELGPIO_H_
#define _DEV_GPIO_INTEL_INTELGPIO_H_
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/gpio.h>
#include <sys/kernel.h>
#include <contrib/dev/acpica/include/acpi.h>
#define INTELGPIO_PADBAR_REG 0x00c
#define INTELGPIO_PAD_SIZE 16
#define INTELGPIO_PADCFG0_GPIOTXSTATE (1 << 0)
#define INTELGPIO_PADCFG0_GPIORXSTATE (1 << 1)
#define INTELGPIO_PADCFG0_GPIOTXDIS (1 << 8)
#define INTELGPIO_PADCFG0_GPIORXDIS (1 << 9)
#define INTELGPIO_PADCFG0_PMODE_MASK (0x7 << 10)
#define INTELGPIO_PADCFG0_PMODE_GPIO 0
#define INTELGPIO_GPIO_NOMAP (-1)
#define INTELGPIO_MAX_COMMUNITIES 8
struct intelgpio_padgroup {
int first_pad;
int npads;
int gpio_base;
const char *name;
};
struct intelgpio_community {
int ngroups;
const struct intelgpio_padgroup *groups;
};
struct intelgpio_platform {
const struct intelgpio_community *communities;
int ncommunities;
char **hids;
const char *desc;
};
struct intelgpio_softc {
device_t sc_dev;
device_t sc_busdev;
struct mtx sc_mtx;
const struct intelgpio_platform *sc_plat;
struct resource *sc_mem_res[INTELGPIO_MAX_COMMUNITIES];
uint32_t sc_padbar[INTELGPIO_MAX_COMMUNITIES];
};
DECLARE_CLASS(intelgpio_driver);
int intelgpio_probe(device_t dev, const struct intelgpio_platform *plat);
int intelgpio_attach(device_t dev, const struct intelgpio_platform *plat);
#endif /* _DEV_GPIO_INTEL_INTELGPIO_H_ */
|