blob: 5f62a65a7800447b7f3546dc62d9b5e2fbad3466 [file] [log] [blame]
Aaron Durbin76c37002012-10-30 09:03:43 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 The Chromium OS Authors. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Aaron Durbin76c37002012-10-30 09:03:43 -050014 */
15
16#ifndef INTEL_LYNXPOINT_GPIO_H
17#define INTEL_LYNXPOINT_GPIO_H
18
Duncan Laurie045f1532012-12-17 11:29:10 -080019/* ICH7 GPIOBASE */
20#define GPIO_USE_SEL 0x00
21#define GP_IO_SEL 0x04
22#define GP_LVL 0x0c
23#define GPO_BLINK 0x18
24#define GPI_INV 0x2c
25#define GPIO_USE_SEL2 0x30
26#define GP_IO_SEL2 0x34
27#define GP_LVL2 0x38
28#define GPIO_USE_SEL3 0x40
29#define GP_IO_SEL3 0x44
30#define GP_LVL3 0x48
31#define GP_RST_SEL1 0x60
32#define GP_RST_SEL2 0x64
33#define GP_RST_SEL3 0x68
34
Aaron Durbin76c37002012-10-30 09:03:43 -050035#define GPIO_MODE_NATIVE 0
36#define GPIO_MODE_GPIO 1
37#define GPIO_MODE_NONE 1
38
39#define GPIO_DIR_OUTPUT 0
40#define GPIO_DIR_INPUT 1
41
42#define GPIO_NO_INVERT 0
43#define GPIO_INVERT 1
44
45#define GPIO_LEVEL_LOW 0
46#define GPIO_LEVEL_HIGH 1
47
48#define GPIO_NO_BLINK 0
49#define GPIO_BLINK 1
50
51#define GPIO_RESET_PWROK 0
52#define GPIO_RESET_RSMRST 1
53
54struct pch_gpio_set1 {
55 u32 gpio0 : 1;
56 u32 gpio1 : 1;
57 u32 gpio2 : 1;
58 u32 gpio3 : 1;
59 u32 gpio4 : 1;
60 u32 gpio5 : 1;
61 u32 gpio6 : 1;
62 u32 gpio7 : 1;
63 u32 gpio8 : 1;
64 u32 gpio9 : 1;
65 u32 gpio10 : 1;
66 u32 gpio11 : 1;
67 u32 gpio12 : 1;
68 u32 gpio13 : 1;
69 u32 gpio14 : 1;
70 u32 gpio15 : 1;
71 u32 gpio16 : 1;
72 u32 gpio17 : 1;
73 u32 gpio18 : 1;
74 u32 gpio19 : 1;
75 u32 gpio20 : 1;
76 u32 gpio21 : 1;
77 u32 gpio22 : 1;
78 u32 gpio23 : 1;
79 u32 gpio24 : 1;
80 u32 gpio25 : 1;
81 u32 gpio26 : 1;
82 u32 gpio27 : 1;
83 u32 gpio28 : 1;
84 u32 gpio29 : 1;
85 u32 gpio30 : 1;
86 u32 gpio31 : 1;
87} __attribute__ ((packed));
88
89struct pch_gpio_set2 {
90 u32 gpio32 : 1;
91 u32 gpio33 : 1;
92 u32 gpio34 : 1;
93 u32 gpio35 : 1;
94 u32 gpio36 : 1;
95 u32 gpio37 : 1;
96 u32 gpio38 : 1;
97 u32 gpio39 : 1;
98 u32 gpio40 : 1;
99 u32 gpio41 : 1;
100 u32 gpio42 : 1;
101 u32 gpio43 : 1;
102 u32 gpio44 : 1;
103 u32 gpio45 : 1;
104 u32 gpio46 : 1;
105 u32 gpio47 : 1;
106 u32 gpio48 : 1;
107 u32 gpio49 : 1;
108 u32 gpio50 : 1;
109 u32 gpio51 : 1;
110 u32 gpio52 : 1;
111 u32 gpio53 : 1;
112 u32 gpio54 : 1;
113 u32 gpio55 : 1;
114 u32 gpio56 : 1;
115 u32 gpio57 : 1;
116 u32 gpio58 : 1;
117 u32 gpio59 : 1;
118 u32 gpio60 : 1;
119 u32 gpio61 : 1;
120 u32 gpio62 : 1;
121 u32 gpio63 : 1;
122} __attribute__ ((packed));
123
124struct pch_gpio_set3 {
125 u32 gpio64 : 1;
126 u32 gpio65 : 1;
127 u32 gpio66 : 1;
128 u32 gpio67 : 1;
129 u32 gpio68 : 1;
130 u32 gpio69 : 1;
131 u32 gpio70 : 1;
132 u32 gpio71 : 1;
133 u32 gpio72 : 1;
134 u32 gpio73 : 1;
135 u32 gpio74 : 1;
136 u32 gpio75 : 1;
137} __attribute__ ((packed));
138
139struct pch_gpio_map {
140 struct {
141 const struct pch_gpio_set1 *mode;
142 const struct pch_gpio_set1 *direction;
143 const struct pch_gpio_set1 *level;
144 const struct pch_gpio_set1 *reset;
145 const struct pch_gpio_set1 *invert;
146 const struct pch_gpio_set1 *blink;
147 } set1;
148 struct {
149 const struct pch_gpio_set2 *mode;
150 const struct pch_gpio_set2 *direction;
151 const struct pch_gpio_set2 *level;
152 const struct pch_gpio_set2 *reset;
153 } set2;
154 struct {
155 const struct pch_gpio_set3 *mode;
156 const struct pch_gpio_set3 *direction;
157 const struct pch_gpio_set3 *level;
158 const struct pch_gpio_set3 *reset;
159 } set3;
160};
161
162/* Configure GPIOs with mainboard provided settings */
163void setup_pch_gpios(const struct pch_gpio_map *gpio);
164
Aaron Durbin76c37002012-10-30 09:03:43 -0500165#endif