blob: 69bc82a143bb02fe269585b47803214bb2ed4d52 [file] [log] [blame]
Duncan Laurie86f23ac2015-08-27 16:53:45 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Google Inc.
5 * Copyright (C) 2015 Intel Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Duncan Laurie86f23ac2015-08-27 16:53:45 -070015 */
16
17/* Intel Storage Controllers */
18
19Device (EMMC)
20{
21 Name (_ADR, 0x001E0004)
22 Name (_DDN, "eMMC Controller")
23
24 OperationRegion (EMCR, PCI_Config, 0x00, 0x100)
25 Field (EMCR, DWordAcc, NoLock, Preserve)
26 {
27 Offset (0x84), /* PMECTRLSTATUS */
28 D0D3, 2, /* POWERSTATE */
29 Offset (0xa2), /* PG_CONFIG */
30 , 2,
31 PGEN, 1, /* PG_ENABLE */
32 }
33
34 Method (_PS0, 0, Serialized)
35 {
Duncan Laurieaa1b6b02015-09-23 18:01:45 -070036 /* Disable Power Gate */
Duncan Laurie86f23ac2015-08-27 16:53:45 -070037 Store (0, ^PGEN)
38
39 /* Clear bits 31, 6, 2, 0 */
40 ^^PCRA (PID_SCS, 0x600, 0x7FFFFFBA)
41 Sleep (2)
42
43 /* Set bits 31, 6, 2, 0 */
44 ^^PCRO (PID_SCS, 0x600, 0x80000045)
45
46 /* Set Power State to D0 */
Duncan Laurieaa1b6b02015-09-23 18:01:45 -070047 Store (Zero, Local0)
48 Store (Local0, ^D0D3)
Duncan Laurie86f23ac2015-08-27 16:53:45 -070049 Store (^D0D3, Local0)
50 }
51
52 Method (_PS3, 0, Serialized)
53 {
Duncan Laurieaa1b6b02015-09-23 18:01:45 -070054 /* Enable Power Gate */
Duncan Laurie86f23ac2015-08-27 16:53:45 -070055 Store (1, ^PGEN)
56
57 /* Set Power State to D0 */
Duncan Laurieaa1b6b02015-09-23 18:01:45 -070058 Store (3, Local0)
59 Store (Local0, ^D0D3)
Duncan Laurie86f23ac2015-08-27 16:53:45 -070060 Store (^D0D3, Local0)
61 }
62
63 Device (CARD)
64 {
65 Name (_ADR, 0x00000008)
66 Method (_RMV, 0, NotSerialized)
67 {
68 Return (0)
69 }
70 }
71}
72
Subrata Banik086730b2015-12-02 11:42:04 +053073#if !IS_ENABLED(CONFIG_EXCLUDE_NATIVE_SD_INTERFACE)
Duncan Laurie86f23ac2015-08-27 16:53:45 -070074Device (SDXC)
75{
76 Name (_ADR, 0x001E0006)
77 Name (_DDN, "SD Controller")
78
79 OperationRegion (SDCR, PCI_Config, 0x00, 0x100)
80 Field (SDCR, DWordAcc, NoLock, Preserve)
81 {
82 Offset (0x84), /* PMECTRLSTATUS */
83 D0D3, 2, /* POWERSTATE */
84 Offset (0xa2), /* PG_CONFIG */
85 , 2,
86 PGEN, 1, /* PG_ENABLE */
87 }
88
89 Method (_PS0, 0, Serialized)
90 {
Zhuo-hao.Leece37e472016-07-27 13:18:22 +080091 /* Disable 20K pull-down on CLK, CMD and DAT lines */
92 ^^PCRA (PID_GPIOCOM3, 0x4c4, 0xFFFFEFFF)
93 ^^PCRA (PID_GPIOCOM3, 0x4cc, 0xFFFFEFFF)
94 ^^PCRA (PID_GPIOCOM3, 0x4d4, 0xFFFFEFFF)
95 ^^PCRA (PID_GPIOCOM3, 0x4dc, 0xFFFFEFFF)
96 ^^PCRA (PID_GPIOCOM3, 0x4e4, 0xFFFFEFFF)
97 ^^PCRA (PID_GPIOCOM3, 0x4f4, 0xFFFFEFFF)
98
Duncan Laurieaa1b6b02015-09-23 18:01:45 -070099 /* Disable Power Gate */
Duncan Laurie86f23ac2015-08-27 16:53:45 -0700100 Store (0, ^PGEN)
101
102 /* Clear bits 8, 7, 2, 0 */
103 ^^PCRA (PID_SCS, 0x600, 0xFFFFFE7A)
104 Sleep (2)
105
106 /* Set bits 31, 6, 2, 0 */
107 ^^PCRO (PID_SCS, 0x600, 0x00000185)
108
109 /* Set Power State to D0 */
Duncan Laurieaa1b6b02015-09-23 18:01:45 -0700110 Store (Zero, Local0)
111 Store (Local0, ^D0D3)
Duncan Laurie86f23ac2015-08-27 16:53:45 -0700112 Store (^D0D3, Local0)
113 }
114
115 Method (_PS3, 0, Serialized)
116 {
Duncan Laurieaa1b6b02015-09-23 18:01:45 -0700117 /* Enable Power Gate */
Duncan Laurie86f23ac2015-08-27 16:53:45 -0700118 Store (1, ^PGEN)
119
120 /* Set Power State to D0 */
Duncan Laurieaa1b6b02015-09-23 18:01:45 -0700121 Store (3, Local0)
122 Store (Local0, ^D0D3)
Duncan Laurie86f23ac2015-08-27 16:53:45 -0700123 Store (^D0D3, Local0)
Zhuo-hao.Leece37e472016-07-27 13:18:22 +0800124
125 /* Enable 20K pull-down on CLK, CMD and DAT lines */
126 ^^PCRO (PID_GPIOCOM3, 0x4c4, 0x00001000)
127 ^^PCRO (PID_GPIOCOM3, 0x4cc, 0x00001000)
128 ^^PCRO (PID_GPIOCOM3, 0x4d4, 0x00001000)
129 ^^PCRO (PID_GPIOCOM3, 0x4dc, 0x00001000)
130 ^^PCRO (PID_GPIOCOM3, 0x4e4, 0x00001000)
131 ^^PCRO (PID_GPIOCOM3, 0x4f4, 0x00001000)
Duncan Laurie86f23ac2015-08-27 16:53:45 -0700132 }
133
134 Device (CARD)
135 {
136 Name (_ADR, 0x00000008)
137 Method (_RMV, 0, NotSerialized)
138 {
139 Return (1)
140 }
141 }
142}
Subrata Banik086730b2015-12-02 11:42:04 +0530143#endif