blob: 2c64f7946b39f20c47940876f0fbba539c60af62 (
plain)
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
|
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef EC_KONTRON_KEMPLD_INTERNAL_H
#define EC_KONTRON_KEMPLD_INTERNAL_H
#include <device/device.h>
/* i/o ports */
#define KEMPLD_IDX 0xa80
#define KEMPLD_MUTEX_KEY 0x80
#define KEMPLD_DAT 0xa81
/* indexed registers */
#define KEMPLD_SPEC 0x06
#define KEMPLD_SPEC_GET_MINOR(x) ((x) & 0x0f)
#define KEMPLD_SPEC_GET_MAJOR(x) ((x) >> 4 & 0x0f)
#define KEMPLD_CFG 0x37
#define KEMPLD_CFG_GPIO_I2C_MUX (1 << 0)
#define KEMPLD_UART_0 0x30
#define KEMPLD_UART_1 0x31
#define KEMPLD_UART_IRQ_SHIFT 0
#define KEMPLD_UART_IRQ_MASK (0xf << KEMPLD_UART_IRQ_SHIFT)
#define KEMPLD_UART_IO_SHIFT 4
#define KEMPLD_UART_IO_MASK (0x3 << KEMPLD_UART_IO_SHIFT)
#define KEMPLD_UART_ENABLE 0x80
#define KEMPLD_CLK 33333333 /* 33MHz */
#define KEMPLD_GPIO_MASK(pin_num) (1 << ((pin_num) % 8))
#define KEMPLD_GPIO_DIR(pin_num) (0x40 + (pin_num) / 8)
#define KEMPLD_GPIO_LVL(pin_num) (0x42 + (pin_num) / 8)
void kempld_i2c_device_init(struct device *const dev);
int kempld_gpio_pads_config(struct device *dev);
#endif /* EC_KONTRON_KEMPLD_INTERNAL_H */
|