summaryrefslogtreecommitdiff
path: root/src/soc/marvell/mvmap2315/include/soc/gpio.h
blob: 93535de90ff02d4be522af74e4a38e715c7bc785 (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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2016 Marvell, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __SOC_MARVELL_MVMAP2315_GPIO_H__
#define __SOC_MARVELL_MVMAP2315_GPIO_H__

#include <stdint.h>

#include <types.h>

#define GPIO(b, i)		((gpio_t){.bank = GPIO_##b, .idx = i})
#define GET_GPIO_PAD(gpio)	((gpio.bank * 32) + gpio.idx + 160)

struct mvmap2315_gpio_regs {
	u32 plr;
	u32 pdr;
	u32 psr;
	u32 pcr;
	u32 hripr;
	u32 lfipr;
	u32 isr;
	u32 sdr;
	u32 cdr;
	u32 shripr;
	u32 chripr;
	u32 slfipr;
	u32 clfipr;
	u32 olr;
	u32 dwer;
	u32 imr;
	u32 rev0;
	u32 rev1;
	u32 simr;
	u32 cimr;
	u32 iter0;
	u32 iter1;
	u32 iter2;
	u32 iter3;
	u32 iter4;
	u32 iter5;
	u32 iter6;
	u32 iter7;
	u32 iter8;
	u32 iter9;
	u32 iter10;
	u32 iter11;
	u32 iter12;
	u32 iter13;
	u32 iter14;
	u32 iter15;
	u32 iter16;
	u32 iter17;
	u32 iter18;
	u32 iter19;
	u32 iter20;
	u32 iter21;
	u32 iter22;
	u32 iter23;
};

check_member(mvmap2315_gpio_regs, iter23, 0xac);

typedef union {
	u32 raw;
	struct {
		u16 port;
		union {
			struct {
				u16 num : 5;
				u16 reserved1 : 11;
			};
			struct {
				u16 idx : 3;
				u16 bank : 2;
				u16 reserved2 : 11;
			};
		};
	};
} gpio_t;

enum {
	GPIO_F = 0,
	GPIO_G = 1,
	GPIO_H = 2,
};

#endif /* __SOC_MARVELL_MVMAP2315_GPIO_H__ */