blob: 1aaec5faecc6375145da8c2ce7332a1a17fe465d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass8fa4d5a2015-08-30 16:55:27 -06002/*
3 * (C) Copyright 2015 Google, Inc
Simon Glass8fa4d5a2015-08-30 16:55:27 -06004 */
5
6#ifndef _ASM_ARCH_GPIO_H
7#define _ASM_ARCH_GPIO_H
8
9struct rockchip_gpio_regs {
10 u32 swport_dr;
11 u32 swport_ddr;
12 u32 reserved0[(0x30 - 0x08) / 4];
13 u32 inten;
14 u32 intmask;
15 u32 inttype_level;
16 u32 int_polarity;
17 u32 int_status;
18 u32 int_rawstatus;
19 u32 debounce;
20 u32 porta_eoi;
21 u32 ext_port;
22 u32 reserved1[(0x60 - 0x54) / 4];
23 u32 ls_sync;
24};
25check_member(rockchip_gpio_regs, ls_sync, 0x60);
26
Simon Glassb3e0a5a2019-01-21 14:53:33 -070027enum gpio_pu_pd {
28 GPIO_PULL_NORMAL = 0,
29 GPIO_PULL_UP,
30 GPIO_PULL_DOWN,
31 GPIO_PULL_REPEAT,
32};
33
Simon Glassf642c532019-01-21 14:53:34 -070034/* These defines are only used by spl_gpio.h */
35enum {
36 /* Banks have 8 GPIOs, so 3 bits, and there are 4 banks, so 2 bits */
37 GPIO_BANK_SHIFT = 3,
38 GPIO_BANK_MASK = 3 << GPIO_BANK_SHIFT,
39
40 GPIO_OFFSET_MASK = 0x1f,
41};
42
43#define GPIO(bank, offset) ((bank) << GPIO_BANK_SHIFT | (offset))
44
45enum gpio_bank_t {
46 BANK_A = 0,
47 BANK_B,
48 BANK_C,
49 BANK_D,
50};
51
52enum gpio_dir_t {
53 GPIO_INPUT = 0,
54 GPIO_OUTPUT,
55};
56
Simon Glass8fa4d5a2015-08-30 16:55:27 -060057#endif