blob: 53c5c96ebccb19f0d3c041b8c7382d6afe65bba4 [file] [log] [blame]
Arthur Heymans62902ca2016-11-29 14:13:43 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2016 Arthur Heymans <arthur@aheymans.xyz>
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.
14 */
15
16#include <southbridge/intel/common/gpio.h>
17
18static const struct pch_gpio_set1 pch_gpio_set1_mode = {
19 .gpio1 = GPIO_MODE_GPIO,
20 .gpio5 = GPIO_MODE_GPIO,
21 .gpio6 = GPIO_MODE_GPIO,
22 .gpio7 = GPIO_MODE_GPIO,
23 .gpio8 = GPIO_MODE_GPIO,
24 .gpio9 = GPIO_MODE_GPIO,
25 .gpio10 = GPIO_MODE_GPIO,
26 .gpio12 = GPIO_MODE_GPIO,
27 .gpio13 = GPIO_MODE_GPIO,
28 .gpio14 = GPIO_MODE_GPIO,
29 .gpio15 = GPIO_MODE_GPIO,
30 .gpio22 = GPIO_MODE_GPIO,
31 .gpio24 = GPIO_MODE_GPIO,
32 .gpio25 = GPIO_MODE_GPIO,
33 .gpio26 = GPIO_MODE_GPIO,
34 .gpio27 = GPIO_MODE_GPIO,
35 .gpio28 = GPIO_MODE_GPIO,
36};
37
38static const struct pch_gpio_set1 pch_gpio_set1_direction = {
39 .gpio1 = GPIO_DIR_INPUT,
40 .gpio5 = GPIO_DIR_OUTPUT,
41 .gpio6 = GPIO_DIR_OUTPUT,
42 .gpio7 = GPIO_DIR_INPUT,
43 .gpio8 = GPIO_DIR_INPUT,
44 .gpio9 = GPIO_DIR_INPUT,
45 .gpio10 = GPIO_DIR_INPUT,
46 .gpio12 = GPIO_DIR_OUTPUT,
47 .gpio13 = GPIO_DIR_INPUT,
48 .gpio14 = GPIO_DIR_OUTPUT,
49 .gpio15 = GPIO_DIR_INPUT,
50 .gpio22 = GPIO_DIR_OUTPUT,
51 .gpio24 = GPIO_DIR_OUTPUT,
52 .gpio25 = GPIO_DIR_INPUT,
53 .gpio26 = GPIO_DIR_INPUT,
54 .gpio27 = GPIO_DIR_INPUT,
55 .gpio28 = GPIO_DIR_INPUT,
56};
57
58static const struct pch_gpio_set1 pch_gpio_set1_level = {
59#if (CONFIG_BOARD_APPLE_MACBOOK11 || CONFIG_BOARD_APPLE_MACBOOK21)
60 .gpio5 = GPIO_LEVEL_LOW,
61#else /* CONFIG_BOARD_APPLE_IMAC52 */
62 .gpio5 = GPIO_LEVEL_HIGH,
63#endif
64 .gpio6 = GPIO_LEVEL_HIGH,
65 .gpio12 = GPIO_LEVEL_LOW,
66 .gpio14 = GPIO_LEVEL_HIGH,
67 .gpio22 = GPIO_LEVEL_HIGH,
68 .gpio24 = GPIO_LEVEL_LOW,
69};
70
71static const struct pch_gpio_set1 pch_gpio_set1_invert = {
72 .gpio1 = GPIO_INVERT,
73 .gpio7 = GPIO_INVERT,
74#if (CONFIG_BOARD_APPLE_MACBOOK11 || CONFIG_BOARD_APPLE_MACBOOK21)
75 .gpio13 = GPIO_INVERT,
76#endif
77};
78
79static const struct pch_gpio_set1 pch_gpio_set1_blink = {
80};
81
82static const struct pch_gpio_set2 pch_gpio_set2_mode = {
83#if CONFIG_BOARD_APPLE_IMAC52
84 .gpio35 = GPIO_MODE_GPIO,
85#endif
86 .gpio38 = GPIO_MODE_GPIO,
87 .gpio39 = GPIO_MODE_GPIO,
88 .gpio48 = GPIO_MODE_GPIO,
89};
90
91static const struct pch_gpio_set2 pch_gpio_set2_direction = {
92#if CONFIG_BOARD_APPLE_IMAC52
93 .gpio35 = GPIO_DIR_OUTPUT,
94#endif
95 .gpio38 = GPIO_DIR_OUTPUT,
96 .gpio39 = GPIO_DIR_OUTPUT,
97 .gpio48 = GPIO_DIR_OUTPUT,
98};
99
100static const struct pch_gpio_set2 pch_gpio_set2_level = {
101#if CONFIG_BOARD_APPLE_IMAC52
102 .gpio35 = GPIO_LEVEL_LOW,
103#endif
104 .gpio38 = GPIO_LEVEL_HIGH,
105 .gpio39 = GPIO_LEVEL_HIGH,
106 .gpio48 = GPIO_LEVEL_HIGH,
107};
108
109const struct pch_gpio_map mainboard_gpio_map = {
110 .set1 = {
111 .mode = &pch_gpio_set1_mode,
112 .direction = &pch_gpio_set1_direction,
113 .level = &pch_gpio_set1_level,
114 .blink = &pch_gpio_set1_blink,
115 .invert = &pch_gpio_set1_invert,
116 },
117 .set2 = {
118 .mode = &pch_gpio_set2_mode,
119 .direction = &pch_gpio_set2_direction,
120 .level = &pch_gpio_set2_level,
121 },
122};