Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 1 | /* |
| 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 Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | /* Intel Storage Controllers */ |
| 18 | |
| 19 | Device (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 Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 36 | /* Disable Power Gate */ |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 37 | 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 Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 47 | Store (Zero, Local0) |
| 48 | Store (Local0, ^D0D3) |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 49 | Store (^D0D3, Local0) |
| 50 | } |
| 51 | |
| 52 | Method (_PS3, 0, Serialized) |
| 53 | { |
Duncan Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 54 | /* Enable Power Gate */ |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 55 | Store (1, ^PGEN) |
| 56 | |
| 57 | /* Set Power State to D0 */ |
Duncan Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 58 | Store (3, Local0) |
| 59 | Store (Local0, ^D0D3) |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 60 | 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 Banik | 086730b | 2015-12-02 11:42:04 +0530 | [diff] [blame] | 73 | #if !IS_ENABLED(CONFIG_EXCLUDE_NATIVE_SD_INTERFACE) |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 74 | Device (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.Lee | ce37e47 | 2016-07-27 13:18:22 +0800 | [diff] [blame^] | 91 | /* 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 Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 99 | /* Disable Power Gate */ |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 100 | 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 Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 110 | Store (Zero, Local0) |
| 111 | Store (Local0, ^D0D3) |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 112 | Store (^D0D3, Local0) |
| 113 | } |
| 114 | |
| 115 | Method (_PS3, 0, Serialized) |
| 116 | { |
Duncan Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 117 | /* Enable Power Gate */ |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 118 | Store (1, ^PGEN) |
| 119 | |
| 120 | /* Set Power State to D0 */ |
Duncan Laurie | aa1b6b0 | 2015-09-23 18:01:45 -0700 | [diff] [blame] | 121 | Store (3, Local0) |
| 122 | Store (Local0, ^D0D3) |
Duncan Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 123 | Store (^D0D3, Local0) |
Zhuo-hao.Lee | ce37e47 | 2016-07-27 13:18:22 +0800 | [diff] [blame^] | 124 | |
| 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 Laurie | 86f23ac | 2015-08-27 16:53:45 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | Device (CARD) |
| 135 | { |
| 136 | Name (_ADR, 0x00000008) |
| 137 | Method (_RMV, 0, NotSerialized) |
| 138 | { |
| 139 | Return (1) |
| 140 | } |
| 141 | } |
| 142 | } |
Subrata Banik | 086730b | 2015-12-02 11:42:04 +0530 | [diff] [blame] | 143 | #endif |