]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/google/chromebook_link/link.c
88cee052415116a8ad05c7a94881a436259d32f0
[people/ms/u-boot.git] / board / google / chromebook_link / link.c
1 /*
2 * Copyright (C) 2014 Google, Inc
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7 #include <common.h>
8 #include <asm/gpio.h>
9
10 int arch_early_init_r(void)
11 {
12 return 0;
13 }
14
15 int board_early_init_r(void)
16 {
17 return 0;
18 }
19
20 static const struct pch_gpio_set1 pch_gpio_set1_mode = {
21 .gpio0 = GPIO_MODE_GPIO, /* NMI_DBG# */
22 .gpio3 = GPIO_MODE_GPIO, /* ALS_INT# */
23 .gpio5 = GPIO_MODE_GPIO, /* SIM_DET */
24 .gpio7 = GPIO_MODE_GPIO, /* EC_SCI# */
25 .gpio8 = GPIO_MODE_GPIO, /* EC_SMI# */
26 .gpio9 = GPIO_MODE_GPIO, /* RECOVERY# */
27 .gpio10 = GPIO_MODE_GPIO, /* SPD vector D3 */
28 .gpio11 = GPIO_MODE_GPIO, /* smbalert#, let's keep it initialized */
29 .gpio12 = GPIO_MODE_GPIO, /* TP_INT# */
30 .gpio14 = GPIO_MODE_GPIO, /* Touch_INT_L */
31 .gpio15 = GPIO_MODE_GPIO, /* EC_LID_OUT# (EC_WAKE#) */
32 .gpio21 = GPIO_MODE_GPIO, /* EC_IN_RW */
33 .gpio24 = GPIO_MODE_GPIO, /* DDR3L_EN */
34 .gpio28 = GPIO_MODE_GPIO, /* SLP_ME_CSW_DEV# */
35 };
36
37 static const struct pch_gpio_set1 pch_gpio_set1_direction = {
38 .gpio0 = GPIO_DIR_INPUT,
39 .gpio3 = GPIO_DIR_INPUT,
40 .gpio5 = GPIO_DIR_INPUT,
41 .gpio7 = GPIO_DIR_INPUT,
42 .gpio8 = GPIO_DIR_INPUT,
43 .gpio9 = GPIO_DIR_INPUT,
44 .gpio10 = GPIO_DIR_INPUT,
45 .gpio11 = GPIO_DIR_INPUT,
46 .gpio12 = GPIO_DIR_INPUT,
47 .gpio14 = GPIO_DIR_INPUT,
48 .gpio15 = GPIO_DIR_INPUT,
49 .gpio21 = GPIO_DIR_INPUT,
50 .gpio24 = GPIO_DIR_OUTPUT,
51 .gpio28 = GPIO_DIR_INPUT,
52 };
53
54 static const struct pch_gpio_set1 pch_gpio_set1_level = {
55 .gpio1 = GPIO_LEVEL_HIGH,
56 .gpio6 = GPIO_LEVEL_HIGH,
57 .gpio24 = GPIO_LEVEL_LOW,
58 };
59
60 static const struct pch_gpio_set1 pch_gpio_set1_invert = {
61 .gpio7 = GPIO_INVERT,
62 .gpio8 = GPIO_INVERT,
63 .gpio12 = GPIO_INVERT,
64 .gpio14 = GPIO_INVERT,
65 .gpio15 = GPIO_INVERT,
66 };
67
68 static const struct pch_gpio_set2 pch_gpio_set2_mode = {
69 .gpio36 = GPIO_MODE_GPIO, /* W_DISABLE_L */
70 .gpio41 = GPIO_MODE_GPIO, /* SPD vector D0 */
71 .gpio42 = GPIO_MODE_GPIO, /* SPD vector D1 */
72 .gpio43 = GPIO_MODE_GPIO, /* SPD vector D2 */
73 .gpio57 = GPIO_MODE_GPIO, /* PCH_SPI_WP_D */
74 .gpio60 = GPIO_MODE_GPIO, /* DRAMRST_CNTRL_PCH */
75 };
76
77 static const struct pch_gpio_set2 pch_gpio_set2_direction = {
78 .gpio36 = GPIO_DIR_OUTPUT,
79 .gpio41 = GPIO_DIR_INPUT,
80 .gpio42 = GPIO_DIR_INPUT,
81 .gpio43 = GPIO_DIR_INPUT,
82 .gpio57 = GPIO_DIR_INPUT,
83 .gpio60 = GPIO_DIR_OUTPUT,
84 };
85
86 static const struct pch_gpio_set2 pch_gpio_set2_level = {
87 .gpio36 = GPIO_LEVEL_HIGH,
88 .gpio60 = GPIO_LEVEL_HIGH,
89 };
90
91 static const struct pch_gpio_set3 pch_gpio_set3_mode = {
92 };
93
94 static const struct pch_gpio_set3 pch_gpio_set3_direction = {
95 };
96
97 static const struct pch_gpio_set3 pch_gpio_set3_level = {
98 };
99
100 static const struct pch_gpio_map link_gpio_map = {
101 .set1 = {
102 .mode = &pch_gpio_set1_mode,
103 .direction = &pch_gpio_set1_direction,
104 .level = &pch_gpio_set1_level,
105 .invert = &pch_gpio_set1_invert,
106 },
107 .set2 = {
108 .mode = &pch_gpio_set2_mode,
109 .direction = &pch_gpio_set2_direction,
110 .level = &pch_gpio_set2_level,
111 },
112 .set3 = {
113 .mode = &pch_gpio_set3_mode,
114 .direction = &pch_gpio_set3_direction,
115 .level = &pch_gpio_set3_level,
116 },
117 };
118
119 int board_early_init_f(void)
120 {
121 ich_gpio_set_gpio_map(&link_gpio_map);
122
123 return 0;
124 }