blob: 2ec8569e8aa0ccab4835880f5f68949c32ac521c [file] [log] [blame]
Angel Pons32abdd62020-04-05 15:47:03 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aamir Bohra3ee54bb2018-10-17 11:55:01 +05302
3#include <soc/pcr_ids.h>
4
5Scope (\_SB.PCI0) {
6
7 /*
8 * Clear register 0x1C20/0x4820
9 * Arg0 - PCR Port ID
10 */
11 Method(SCSC, 1, Serialized)
12 {
13 ^PCRA (Arg0, 0x1C20, 0x0)
14 ^PCRA (Arg0, 0x4820, 0x0)
15 }
16
17 /* EMMC */
18 Device(PEMC) {
19 Name(_ADR, 0x001A0000)
20 Name (_DDN, "eMMC Controller")
21 Name (TEMP, 0)
22
23 OperationRegion(SCSR, PCI_Config, 0x00, 0x100)
24 Field(SCSR, WordAcc, NoLock, Preserve) {
25 Offset (0x84), /* PMECTRLSTATUS */
26 PMCR, 16,
27 Offset (0xA2), /* PG_CONFIG */
28 , 2,
29 PGEN, 1, /* PG_ENABLE */
30 }
31
32 Method(_INI) {
33 /* Clear register 0x1C20/0x4820 */
34 ^^SCSC (PID_EMMC)
35 }
36
37 Method(_PS0, 0, Serialized) {
38 Stall (50) // Sleep 50 us
39
Felix Singer8cc29622022-12-12 07:33:35 +010040 PGEN = 0 // Disable PG
Aamir Bohra3ee54bb2018-10-17 11:55:01 +053041
42 /* Clear register 0x1C20/0x4820 */
43 ^^SCSC (PID_EMMC)
44
45 /* Set Power State to D0 */
46 And (PMCR, 0xFFFC, PMCR)
Felix Singer8cc29622022-12-12 07:33:35 +010047 ^TEMP = PMCR
Aamir Bohra3ee54bb2018-10-17 11:55:01 +053048 }
49
50 Method(_PS3, 0, Serialized) {
Felix Singer8cc29622022-12-12 07:33:35 +010051 PGEN = 1 // Enable PG
Aamir Bohra3ee54bb2018-10-17 11:55:01 +053052
53 /* Set Power State to D3 */
Felix Singer86bc2e72022-12-16 04:40:39 +010054 PMCR |= 3
Felix Singer8cc29622022-12-12 07:33:35 +010055 ^TEMP = PMCR
Aamir Bohra3ee54bb2018-10-17 11:55:01 +053056 }
57
58 Device (CARD)
59 {
60 Name (_ADR, 0x00000008)
61 Method (_RMV, 0, NotSerialized)
62 {
63 Return (0)
64 }
65 }
66 }
67
68 /* SD CARD */
69 Device (SDXC)
70 {
71 Name (_ADR, 0x00140005)
72 Name (_DDN, "SD Controller")
73 Name (TEMP, 0)
74
75 OperationRegion (SDPC, PCI_Config, 0x00, 0x100)
76 Field (SDPC, WordAcc, NoLock, Preserve)
77 {
78 Offset (0x84), /* PMECTRLSTATUS */
79 PMCR, 16,
80 Offset (0xA2), /* PG_CONFIG */
81 , 2,
82 PGEN, 1, /* PG_ENABLE */
83 }
84
85 Method(_INI)
86 {
87 /* Clear register 0x1C20/0x4820 */
88 ^^SCSC (PID_SDX)
89 }
90
91 Method (_PS0, 0, Serialized)
92 {
Felix Singer8cc29622022-12-12 07:33:35 +010093 PGEN = 0 /* Disable PG */
Aamir Bohra3ee54bb2018-10-17 11:55:01 +053094
95 /* Clear register 0x1C20/0x4820 */
96 ^^SCSC (PID_SDX)
97
98 /* Set Power State to D0 */
99 And (PMCR, 0xFFFC, PMCR)
Felix Singer8cc29622022-12-12 07:33:35 +0100100 ^TEMP = PMCR
Aamir Bohra3ee54bb2018-10-17 11:55:01 +0530101 }
102
103 Method (_PS3, 0, Serialized)
104 {
Felix Singer8cc29622022-12-12 07:33:35 +0100105 PGEN = 1 /* Enable PG */
Aamir Bohra3ee54bb2018-10-17 11:55:01 +0530106
107 /* Set Power State to D3 */
Felix Singer86bc2e72022-12-16 04:40:39 +0100108 PMCR |= 3
Felix Singer8cc29622022-12-12 07:33:35 +0100109 ^TEMP = PMCR
Aamir Bohra3ee54bb2018-10-17 11:55:01 +0530110 }
111
112 Device (CARD)
113 {
114 Name (_ADR, 0x00000008)
115 Method (_RMV, 0, NotSerialized)
116 {
117 Return (1)
118 }
119 }
120 } /* Device (SDXC) */
121}