1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (c) 2017 Intel Corporation
4 *
5 * Partially based on southcluster.asl for other x86 platforms
6 */
7
8Device (PCI0)
9{
10    Name (_HID, EISAID("PNP0A08"))    /* PCIe */
11    Name (_CID, EISAID("PNP0A03"))    /* PCI */
12
13    Name (_ADR, 0)
14    Name (_BBN, 0)
15
16    Name (MCRS, ResourceTemplate()
17    {
18        /* Bus Numbers */
19        WordBusNumber(ResourceProducer, MinFixed, MaxFixed, PosDecode,
20                0x0000, 0x0000, 0x00ff, 0x0000, 0x0100, , , PB00)
21
22        /* IO Region 0 */
23        WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
24                0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8, , , PI00)
25
26        /* PCI Config Space */
27        IO(Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
28
29        /* IO Region 1 */
30        WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
31                0x0000, 0x0d00, 0xffff, 0x0000, 0xf300, , , PI01)
32
33        /* GPIO Low Memory Region */
34        DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
35                Cacheable, ReadWrite,
36                0x00000000, 0x000ddcc0, 0x000ddccf, 0x00000000,
37                0x00000010, , , GP00)
38
39        /* PSH Memory Region 0 */
40        DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
41                Cacheable, ReadWrite,
42                0x00000000, 0x04819000, 0x04898fff, 0x00000000,
43                0x00080000, , , PSH0)
44
45        /* PSH Memory Region 1 */
46        DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
47                Cacheable, ReadWrite,
48                0x00000000, 0x04919000, 0x04920fff, 0x00000000,
49                0x00008000, , , PSH1)
50
51        /* SST Memory Region */
52        DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
53                Cacheable, ReadWrite,
54                0x00000000, 0x05e00000, 0x05ffffff, 0x00000000,
55                0x00200000, , , SST0)
56
57        /* PCI Memory Region */
58        DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
59                Cacheable, ReadWrite,
60                0x00000000, 0x80000000, 0xffffffff, 0x00000000,
61                0x80000000, , , PMEM)
62    })
63
64    Method (_CRS, 0, Serialized)
65    {
66        Return (MCRS)
67    }
68
69    Method (_OSC, 4)
70    {
71        /* Check for proper GUID */
72        If (LEqual(Arg0, ToUUID("33db4d5b-1ff7-401c-9657-7441c03dd766"))) {
73            /* Let OS control everything */
74            Return (Arg3)
75        } Else {
76            /* Unrecognized UUID */
77            CreateDWordField(Arg3, 0, CDW1)
78            Or(CDW1, 4, CDW1)
79            Return (Arg3)
80        }
81    }
82
83    Device (SDHC)
84    {
85        Name (_ADR, 0x00010003)
86        Name (_DEP, Package (0x01)
87        {
88            GPIO
89        })
90        Name (PSTS, Zero)
91
92        Method (_STA)
93        {
94            Return (STA_VISIBLE)
95        }
96
97        Method (_PS3, 0, NotSerialized)
98        {
99        }
100
101        Method (_PS0, 0, NotSerialized)
102        {
103            If (PSTS == Zero)
104            {
105                If (^^GPIO.AVBL == One)
106                {
107                    ^^GPIO.WFD3 = One
108                    PSTS = One
109                }
110            }
111        }
112
113        /* BCM43340 */
114        Device (BRC1)
115        {
116            Name (_ADR, 0x01)
117            Name (_DEP, Package (0x01)
118            {
119                GPIO
120            })
121
122            Method (_STA)
123            {
124                Return (STA_VISIBLE)
125            }
126
127            Method (_RMV, 0, NotSerialized)
128            {
129                Return (Zero)
130            }
131
132            Method (_PS3, 0, NotSerialized)
133            {
134                If (^^^GPIO.AVBL == One)
135                {
136                    ^^^GPIO.WFD3 = Zero
137                    PSTS = Zero
138                }
139            }
140
141            Method (_PS0, 0, NotSerialized)
142            {
143                If (PSTS == Zero)
144                {
145                    If (^^^GPIO.AVBL == One)
146                    {
147                        ^^^GPIO.WFD3 = One
148                        PSTS = One
149                    }
150                }
151            }
152        }
153
154        Device (BRC2)
155        {
156            Name (_ADR, 0x02)
157            Method (_STA, 0, NotSerialized)
158            {
159                Return (STA_VISIBLE)
160            }
161
162            Method (_RMV, 0, NotSerialized)
163            {
164                Return (Zero)
165            }
166        }
167    }
168
169    Device (SPI5)
170    {
171        Name (_ADR, 0x00070001)
172        Name (RBUF, ResourceTemplate()
173        {
174            GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
175                "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 110 }
176            GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
177                "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 111 }
178            GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
179                "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 112 }
180            GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
181                "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 113 }
182        })
183
184        Method (_CRS, 0, NotSerialized)
185        {
186            Return (RBUF)
187        }
188
189        /*
190         * See
191         * http://www.kernel.org/doc/Documentation/acpi/gpio-properties.txt
192         * for more information about GPIO bindings.
193         */
194        Name (_DSD, Package () {
195            ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
196            Package () {
197                Package () {
198                    "cs-gpios", Package () {
199                        ^SPI5, 0, 0, 0,
200                        ^SPI5, 1, 0, 0,
201                        ^SPI5, 2, 0, 0,
202                        ^SPI5, 3, 0, 0,
203                    },
204                },
205            }
206        })
207
208        Method (_STA, 0, NotSerialized)
209        {
210            Return (STA_VISIBLE)
211        }
212    }
213
214    Device (I2C1)
215    {
216        Name (_ADR, 0x00080000)
217
218        Method (_STA, 0, NotSerialized)
219        {
220            Return (STA_VISIBLE)
221        }
222    }
223
224    Device (GPIO)
225    {
226        Name (_ADR, 0x000c0000)
227
228        Method (_STA)
229        {
230            Return (STA_VISIBLE)
231        }
232
233        Name (AVBL, Zero)
234        Method (_REG, 2, NotSerialized)
235        {
236            If (Arg0 == 0x08)
237            {
238                AVBL = Arg1
239            }
240        }
241
242        OperationRegion (GPOP, GeneralPurposeIo, 0, 1)
243        Field (GPOP, ByteAcc, NoLock, Preserve)
244        {
245            Connection (
246                GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
247                    "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 96 }
248            ),
249            WFD3, 1,
250        }
251    }
252
253    Device (PWM0)
254    {
255        Name (_ADR, 0x00170000)
256
257        Method (_STA, 0, NotSerialized)
258        {
259            Return (STA_VISIBLE)
260        }
261    }
262
263    Device (HSU0)
264    {
265        Name (_ADR, 0x00040001)
266
267        Method (_STA, 0, NotSerialized)
268        {
269            Return (STA_VISIBLE)
270        }
271
272        Device (BTH0)
273        {
274            Name (_HID, "BCM2E95")
275            Name (_DEP, Package ()
276            {
277                GPIO,
278                HSU0
279            })
280
281            Method (_STA, 0, NotSerialized)
282            {
283                Return (STA_VISIBLE)
284            }
285
286            Method (_CRS, 0, Serialized)
287            {
288                Name (RBUF, ResourceTemplate ()
289                {
290                    UartSerialBus (0x0001C200, DataBitsEight, StopBitsOne,
291                        0xFC, LittleEndian, ParityTypeNone, FlowControlHardware,
292                        0x20, 0x20, "\\_SB.PCI0.HSU0", 0, ResourceConsumer, , )
293                    GpioInt (Level, ActiveHigh, Exclusive, PullNone, 0,
294                        "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 185 }
295                    GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
296                        "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 184 }
297                    GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
298                        "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 71 }
299                })
300                Return (RBUF)
301            }
302
303            Name (_DSD, Package () {
304                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
305                Package () {
306                    Package () { "host-wakeup-gpios", Package () { ^BTH0, 0, 0, 0 } },
307                    Package () { "device-wakeup-gpios", Package () { ^BTH0, 1, 0, 0 } },
308                    Package () { "shutdown-gpios", Package () { ^BTH0, 2, 0, 0 } },
309                }
310            })
311        }
312    }
313}
314
315Device (FLIS)
316{
317    Name (_HID, "INTC1002")
318    Name (_DDN, "Intel Merrifield Family-Level Interface Shim")
319    Name (RBUF, ResourceTemplate()
320    {
321        Memory32Fixed(ReadWrite, 0xFF0C0000, 0x00008000, )
322        PinGroup("spi5", ResourceProducer, ) { 90, 91, 92, 93, 94, 95, 96 }
323        PinGroup("uart0", ResourceProducer, ) { 115, 116, 117, 118 }
324        PinGroup("uart1", ResourceProducer, ) { 119, 120, 121, 122 }
325        PinGroup("uart2", ResourceProducer, ) { 123, 124, 125, 126 }
326        PinGroup("pwm0", ResourceProducer, ) { 144 }
327        PinGroup("pwm1", ResourceProducer, ) { 145 }
328        PinGroup("pwm2", ResourceProducer, ) { 132 }
329        PinGroup("pwm3", ResourceProducer, ) { 133 }
330    })
331
332    Method (_CRS, 0, NotSerialized)
333    {
334        Return (RBUF)
335    }
336
337    Method (_STA, 0, NotSerialized)
338    {
339        Return (STA_VISIBLE)
340    }
341}
342