mb/lenovo/thinkcentre_a58: Add mainboard
[coreboot.git] / src / mainboard / lenovo / thinkcentre_a58 / gpio.c
blobbd3d581faa64601e2c77ecdffc6d3a9ac91e6c50
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2017 Arthur Heymans <arthur@aheymans.xyz>
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.
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.
16 #include <southbridge/intel/common/gpio.h>
18 static const struct pch_gpio_set1 pch_gpio_set1_mode = {
19 .gpio0 = GPIO_MODE_GPIO,
20 .gpio6 = GPIO_MODE_GPIO,
21 .gpio7 = GPIO_MODE_GPIO,
22 .gpio8 = GPIO_MODE_GPIO,
23 .gpio9 = GPIO_MODE_GPIO,
24 .gpio10 = GPIO_MODE_GPIO,
25 .gpio12 = GPIO_MODE_GPIO,
26 .gpio13 = GPIO_MODE_GPIO,
27 .gpio14 = GPIO_MODE_GPIO,
28 .gpio15 = GPIO_MODE_GPIO,
29 .gpio16 = GPIO_MODE_GPIO,
30 .gpio17 = GPIO_MODE_GPIO,
31 .gpio18 = GPIO_MODE_GPIO,
32 .gpio19 = GPIO_MODE_GPIO,
33 .gpio20 = GPIO_MODE_GPIO,
34 .gpio22 = GPIO_MODE_GPIO,
35 .gpio24 = GPIO_MODE_GPIO,
36 .gpio25 = GPIO_MODE_GPIO,
37 .gpio26 = GPIO_MODE_GPIO,
38 .gpio27 = GPIO_MODE_GPIO,
39 .gpio28 = GPIO_MODE_GPIO,
42 static const struct pch_gpio_set1 pch_gpio_set1_direction = {
43 .gpio0 = GPIO_DIR_INPUT,
44 .gpio6 = GPIO_DIR_INPUT,
45 .gpio7 = GPIO_DIR_OUTPUT,
46 .gpio8 = GPIO_DIR_OUTPUT,
47 .gpio9 = GPIO_DIR_OUTPUT,
48 .gpio10 = GPIO_DIR_INPUT,
49 .gpio12 = GPIO_DIR_OUTPUT,
50 .gpio13 = GPIO_DIR_INPUT,
51 .gpio14 = GPIO_DIR_INPUT,
52 .gpio15 = GPIO_DIR_OUTPUT,
53 .gpio16 = GPIO_DIR_OUTPUT,
54 .gpio17 = GPIO_DIR_INPUT,
55 .gpio18 = GPIO_DIR_OUTPUT,
56 .gpio19 = GPIO_DIR_INPUT,
57 .gpio20 = GPIO_DIR_INPUT,
58 .gpio22 = GPIO_DIR_INPUT,
59 .gpio24 = GPIO_DIR_OUTPUT,
60 .gpio25 = GPIO_DIR_OUTPUT,
61 .gpio26 = GPIO_DIR_OUTPUT,
62 .gpio27 = GPIO_DIR_INPUT,
63 .gpio28 = GPIO_DIR_INPUT,
66 static const struct pch_gpio_set1 pch_gpio_set1_level = {
67 .gpio7 = GPIO_LEVEL_HIGH,
68 .gpio8 = GPIO_LEVEL_HIGH,
69 .gpio9 = GPIO_LEVEL_LOW,
70 .gpio12 = GPIO_LEVEL_HIGH,
71 .gpio15 = GPIO_LEVEL_HIGH,
72 .gpio16 = GPIO_LEVEL_LOW,
73 .gpio18 = GPIO_LEVEL_HIGH,
74 .gpio24 = GPIO_LEVEL_LOW,
75 .gpio25 = GPIO_LEVEL_HIGH,
76 .gpio26 = GPIO_LEVEL_LOW,
79 static const struct pch_gpio_set1 pch_gpio_set1_invert = {
80 .gpio0 = GPIO_INVERT,
81 .gpio6 = GPIO_INVERT,
82 .gpio13 = GPIO_INVERT,
85 static const struct pch_gpio_set1 pch_gpio_set1_blink = {
88 static const struct pch_gpio_set2 pch_gpio_set2_mode = {
89 .gpio32 = GPIO_MODE_GPIO,
90 .gpio33 = GPIO_MODE_GPIO,
91 .gpio34 = GPIO_MODE_GPIO,
92 .gpio36 = GPIO_MODE_GPIO,
93 .gpio38 = GPIO_MODE_GPIO,
94 .gpio39 = GPIO_MODE_GPIO,
97 static const struct pch_gpio_set2 pch_gpio_set2_direction = {
98 .gpio32 = GPIO_DIR_OUTPUT,
99 .gpio33 = GPIO_DIR_INPUT,
100 .gpio34 = GPIO_DIR_INPUT,
101 .gpio36 = GPIO_DIR_INPUT,
102 .gpio38 = GPIO_DIR_INPUT,
103 .gpio39 = GPIO_DIR_INPUT,
106 static const struct pch_gpio_set2 pch_gpio_set2_level = {
107 .gpio32 = GPIO_LEVEL_LOW,
110 const struct pch_gpio_map mainboard_gpio_map = {
111 .set1 = {
112 .mode = &pch_gpio_set1_mode,
113 .direction = &pch_gpio_set1_direction,
114 .level = &pch_gpio_set1_level,
115 .blink = &pch_gpio_set1_blink,
116 .invert = &pch_gpio_set1_invert,
118 .set2 = {
119 .mode = &pch_gpio_set2_mode,
120 .direction = &pch_gpio_set2_direction,
121 .level = &pch_gpio_set2_level,