Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Hannah Williams | 3ff14a0 | 2017-05-05 16:30:22 -0700 | [diff] [blame] | 4 | * Copyright (C) 2015 - 2017 Intel Corp. |
Werner Zeh | de3ace0 | 2019-01-15 08:03:43 +0100 | [diff] [blame] | 5 | * Copyright (C) 2017 - 2019 Siemens AG |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 6 | * (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.) |
| 7 | * (Written by Andrey Petrov <andrey.petrov@intel.com> for Intel Corp.) |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
Martin Roth | ebabfad | 2016-04-10 11:09:16 -0600 | [diff] [blame] | 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 18 | */ |
| 19 | |
Hannah Williams | 0f61da8 | 2016-04-18 13:47:08 -0700 | [diff] [blame] | 20 | #include <arch/acpi.h> |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 21 | #include <bootstate.h> |
Lance Zhao | 1bd0c0c | 2016-04-19 18:04:21 -0700 | [diff] [blame] | 22 | #include <cbmem.h> |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 23 | #include <console/console.h> |
Andrey Petrov | a697c19 | 2016-12-07 10:47:46 -0800 | [diff] [blame] | 24 | #include <cpu/x86/mp.h> |
Barnali Sarkar | 66fe0c4 | 2017-05-23 18:17:14 +0530 | [diff] [blame] | 25 | #include <cpu/x86/msr.h> |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 26 | #include <device/device.h> |
| 27 | #include <device/pci.h> |
Mario Scheithauer | 841416f | 2017-09-18 17:08:48 +0200 | [diff] [blame] | 28 | #include <intelblocks/acpi.h> |
Subrata Banik | f699c14 | 2018-06-08 17:57:37 +0530 | [diff] [blame] | 29 | #include <intelblocks/chip.h> |
Barnali Sarkar | e70142c | 2017-03-28 16:32:33 +0530 | [diff] [blame] | 30 | #include <intelblocks/fast_spi.h> |
Barnali Sarkar | 66fe0c4 | 2017-05-23 18:17:14 +0530 | [diff] [blame] | 31 | #include <intelblocks/msr.h> |
Subrata Banik | f699c14 | 2018-06-08 17:57:37 +0530 | [diff] [blame] | 32 | #include <intelblocks/p2sb.h> |
Duncan Laurie | 4c8fbc0 | 2018-03-26 02:19:58 -0700 | [diff] [blame] | 33 | #include <intelblocks/xdci.h> |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 34 | #include <fsp/api.h> |
| 35 | #include <fsp/util.h> |
Barnali Sarkar | 66fe0c4 | 2017-05-23 18:17:14 +0530 | [diff] [blame] | 36 | #include <intelblocks/cpulib.h> |
Bora Guvendik | 33117ec | 2017-04-10 15:49:02 -0700 | [diff] [blame] | 37 | #include <intelblocks/itss.h> |
Shaunak Saha | 93cdc8b | 2017-04-18 15:42:09 -0700 | [diff] [blame] | 38 | #include <intelblocks/pmclib.h> |
Brandon Breitenstein | c6ec8dd | 2016-11-17 12:23:04 -0800 | [diff] [blame] | 39 | #include <romstage_handoff.h> |
Furquan Shaikh | d2c2f83 | 2018-11-07 10:24:31 -0800 | [diff] [blame] | 40 | #include <soc/cpu.h> |
| 41 | #include <soc/heci.h> |
| 42 | #include <soc/intel/common/vbt.h> |
Andrey Petrov | e07e13d | 2016-03-18 14:43:00 -0700 | [diff] [blame] | 43 | #include <soc/iomap.h> |
Bora Guvendik | 33117ec | 2017-04-10 15:49:02 -0700 | [diff] [blame] | 44 | #include <soc/itss.h> |
Lance Zhao | 1bd0c0c | 2016-04-19 18:04:21 -0700 | [diff] [blame] | 45 | #include <soc/nvs.h> |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 46 | #include <soc/pci_devs.h> |
Andrey Petrov | 3dbea29 | 2016-06-14 22:20:28 -0700 | [diff] [blame] | 47 | #include <soc/pm.h> |
Subrata Banik | 7952e28 | 2017-03-14 18:26:27 +0530 | [diff] [blame] | 48 | #include <soc/systemagent.h> |
Furquan Shaikh | d2c2f83 | 2018-11-07 10:24:31 -0800 | [diff] [blame] | 49 | #include <spi-generic.h> |
John Zhao | 7dff726 | 2018-07-30 13:54:25 -0700 | [diff] [blame] | 50 | #include <timer.h> |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 51 | |
| 52 | #include "chip.h" |
| 53 | |
John Zhao | 7dff726 | 2018-07-30 13:54:25 -0700 | [diff] [blame] | 54 | #define DUAL_ROLE_CFG0 0x80d8 |
| 55 | #define SW_VBUS_VALID_MASK (1 << 24) |
| 56 | #define SW_IDPIN_EN_MASK (1 << 21) |
| 57 | #define SW_IDPIN_MASK (1 << 20) |
| 58 | #define SW_IDPIN_HOST (0 << 20) |
| 59 | #define DUAL_ROLE_CFG1 0x80dc |
| 60 | #define DRD_MODE_MASK (1 << 29) |
| 61 | #define DRD_MODE_HOST (1 << 29) |
| 62 | |
John Zhao | 57aa8b6 | 2019-01-14 09:15:50 -0800 | [diff] [blame] | 63 | #define CFG_XHCLKGTEN 0x8650 |
| 64 | /* Naking USB2.0 EPs for Backbone Clock Gating and PLL Shutdown */ |
| 65 | #define NUEFBCGPS (1 << 28) |
| 66 | /* SRAM Power Gate Enable */ |
| 67 | #define SRAMPGTEN (1 << 27) |
| 68 | /* SS Link PLL Shutdown Enable */ |
| 69 | #define SSLSE (1 << 26) |
| 70 | /* USB2 PLL Shutdown Enable */ |
| 71 | #define USB2PLLSE (1 << 25) |
| 72 | /* IOSF Sideband Trunk Clock Gating Enable */ |
| 73 | #define IOSFSTCGE (1 << 24) |
| 74 | /* BIT[23:20] HS Backbone PXP Trunk Clock Gate Enable */ |
| 75 | #define HSTCGE (1 << 23 | 1 << 22) |
| 76 | /* BIT[19:16] SS Backbone PXP Trunk Clock Gate Enable */ |
| 77 | #define SSTCGE (1 << 19 | 1 << 18 | 1 << 17) |
| 78 | /* XHC Ignore_EU3S */ |
| 79 | #define XHCIGEU3S (1 << 15) |
| 80 | /* XHC Frame Timer Clock Shutdown Enable */ |
| 81 | #define XHCFTCLKSE (1 << 14) |
| 82 | /* XHC Backbone PXP Trunk Clock Gate In Presence of ISOCH EP */ |
| 83 | #define XHCBBTCGIPISO (1 << 13) |
| 84 | /* XHC HS Backbone PXP Trunk Clock Gate U2 non RWE */ |
| 85 | #define XHCHSTCGU2NRWE (1 << 12) |
| 86 | /* BIT[11:10] XHC USB2 PLL Shutdown Lx Enable */ |
| 87 | #define XHCUSB2PLLSDLE (1 << 11 | 1 << 10) |
| 88 | /* BIT[9:8] HS Backbone PXP PLL Shutdown Ux Enable */ |
| 89 | #define HSUXDMIPLLSE (1 << 9) |
| 90 | /* BIT[7:5] SS Backbone PXP PLL shutdown Ux Enable */ |
| 91 | #define SSPLLSUE (1 << 6) |
| 92 | /* XHC Backbone Local Clock Gating Enable */ |
| 93 | #define XHCBLCGE (1 << 4) |
| 94 | /* HS Link Trunk Clock Gating Enable */ |
| 95 | #define HSLTCGE (1 << 3) |
| 96 | /* SS Link Trunk Clock Gating Enable */ |
| 97 | #define SSLTCGE (1 << 2) |
| 98 | /* IOSF Backbone Trunk Clock Gating Enable */ |
| 99 | #define IOSFBTCGE (1 << 1) |
| 100 | /* IOSF Gasket Backbone Local Clock Gating Enable */ |
| 101 | #define IOSFGBLCGE (1 << 0) |
| 102 | |
Duncan Laurie | bf713b0 | 2018-05-07 15:33:18 -0700 | [diff] [blame] | 103 | const char *soc_acpi_name(const struct device *dev) |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 104 | { |
| 105 | if (dev->path.type == DEVICE_PATH_DOMAIN) |
| 106 | return "PCI0"; |
| 107 | |
Duncan Laurie | bf713b0 | 2018-05-07 15:33:18 -0700 | [diff] [blame] | 108 | if (dev->path.type == DEVICE_PATH_USB) { |
| 109 | switch (dev->path.usb.port_type) { |
| 110 | case 0: |
| 111 | /* Root Hub */ |
| 112 | return "RHUB"; |
| 113 | case 2: |
| 114 | /* USB2 ports */ |
| 115 | switch (dev->path.usb.port_id) { |
| 116 | case 0: return "HS01"; |
| 117 | case 1: return "HS02"; |
| 118 | case 2: return "HS03"; |
| 119 | case 3: return "HS04"; |
| 120 | case 4: return "HS05"; |
| 121 | case 5: return "HS06"; |
| 122 | case 6: return "HS07"; |
| 123 | case 7: return "HS08"; |
| 124 | } |
| 125 | break; |
| 126 | case 3: |
| 127 | /* USB3 ports */ |
| 128 | switch (dev->path.usb.port_id) { |
| 129 | case 0: return "SS01"; |
| 130 | case 1: return "SS02"; |
| 131 | case 2: return "SS03"; |
| 132 | case 3: return "SS04"; |
| 133 | case 4: return "SS05"; |
| 134 | case 5: return "SS06"; |
| 135 | } |
| 136 | break; |
| 137 | } |
| 138 | return NULL; |
| 139 | } |
| 140 | |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 141 | if (dev->path.type != DEVICE_PATH_PCI) |
| 142 | return NULL; |
| 143 | |
| 144 | switch (dev->path.pci.devfn) { |
| 145 | /* DSDT: acpi/northbridge.asl */ |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 146 | case SA_DEVFN_ROOT: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 147 | return "MCHC"; |
| 148 | /* DSDT: acpi/lpc.asl */ |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 149 | case PCH_DEVFN_LPC: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 150 | return "LPCB"; |
| 151 | /* DSDT: acpi/xhci.asl */ |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 152 | case PCH_DEVFN_XHCI: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 153 | return "XHCI"; |
| 154 | /* DSDT: acpi/pch_hda.asl */ |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 155 | case PCH_DEVFN_HDA: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 156 | return "HDAS"; |
| 157 | /* DSDT: acpi/lpss.asl */ |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 158 | case PCH_DEVFN_UART0: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 159 | return "URT1"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 160 | case PCH_DEVFN_UART1: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 161 | return "URT2"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 162 | case PCH_DEVFN_UART2: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 163 | return "URT3"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 164 | case PCH_DEVFN_UART3: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 165 | return "URT4"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 166 | case PCH_DEVFN_SPI0: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 167 | return "SPI1"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 168 | case PCH_DEVFN_SPI1: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 169 | return "SPI2"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 170 | case PCH_DEVFN_SPI2: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 171 | return "SPI3"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 172 | case PCH_DEVFN_PWM: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 173 | return "PWM"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 174 | case PCH_DEVFN_I2C0: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 175 | return "I2C0"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 176 | case PCH_DEVFN_I2C1: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 177 | return "I2C1"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 178 | case PCH_DEVFN_I2C2: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 179 | return "I2C2"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 180 | case PCH_DEVFN_I2C3: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 181 | return "I2C3"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 182 | case PCH_DEVFN_I2C4: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 183 | return "I2C4"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 184 | case PCH_DEVFN_I2C5: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 185 | return "I2C5"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 186 | case PCH_DEVFN_I2C6: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 187 | return "I2C6"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 188 | case PCH_DEVFN_I2C7: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 189 | return "I2C7"; |
| 190 | /* Storage */ |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 191 | case PCH_DEVFN_SDCARD: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 192 | return "SDCD"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 193 | case PCH_DEVFN_EMMC: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 194 | return "EMMC"; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 195 | case PCH_DEVFN_SDIO: |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 196 | return "SDIO"; |
Vaibhav Shankar | ec9168f | 2016-09-16 14:20:53 -0700 | [diff] [blame] | 197 | /* PCIe */ |
Venkateswarlu Vinjamuri | f03c63e | 2018-04-12 10:13:43 -0700 | [diff] [blame] | 198 | case PCH_DEVFN_PCIE1: |
| 199 | return "RP03"; |
Venkateswarlu Vinjamuri | efeb690 | 2018-04-09 11:14:42 -0700 | [diff] [blame] | 200 | case PCH_DEVFN_PCIE5: |
Vaibhav Shankar | ec9168f | 2016-09-16 14:20:53 -0700 | [diff] [blame] | 201 | return "RP01"; |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | return NULL; |
| 205 | } |
| 206 | |
Elyes HAOUAS | 06e8315 | 2018-05-24 22:48:14 +0200 | [diff] [blame] | 207 | static void pci_domain_set_resources(struct device *dev) |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 208 | { |
Lee Leahy | 1d20fe7 | 2017-03-09 09:50:28 -0800 | [diff] [blame] | 209 | assign_resources(dev->link_list); |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | static struct device_operations pci_domain_ops = { |
| 213 | .read_resources = pci_domain_read_resources, |
| 214 | .set_resources = pci_domain_set_resources, |
| 215 | .enable_resources = NULL, |
| 216 | .init = NULL, |
| 217 | .scan_bus = pci_domain_scan_bus, |
Duncan Laurie | 02fcc88 | 2016-06-27 10:51:17 -0700 | [diff] [blame] | 218 | .acpi_name = &soc_acpi_name, |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 219 | }; |
| 220 | |
| 221 | static struct device_operations cpu_bus_ops = { |
| 222 | .read_resources = DEVICE_NOOP, |
| 223 | .set_resources = DEVICE_NOOP, |
| 224 | .enable_resources = DEVICE_NOOP, |
Aaron Durbin | ac3e482 | 2017-06-14 13:21:00 -0500 | [diff] [blame] | 225 | .init = apollolake_init_cpus, |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 226 | .scan_bus = NULL, |
Hannah Williams | 0f61da8 | 2016-04-18 13:47:08 -0700 | [diff] [blame] | 227 | .acpi_fill_ssdt_generator = generate_cpu_entries, |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 228 | }; |
| 229 | |
Elyes HAOUAS | 06e8315 | 2018-05-24 22:48:14 +0200 | [diff] [blame] | 230 | static void enable_dev(struct device *dev) |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 231 | { |
| 232 | /* Set the operations if it is a special bus type */ |
Lee Leahy | 4430f9f | 2017-03-09 10:00:30 -0800 | [diff] [blame] | 233 | if (dev->path.type == DEVICE_PATH_DOMAIN) |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 234 | dev->ops = &pci_domain_ops; |
Lee Leahy | 4430f9f | 2017-03-09 10:00:30 -0800 | [diff] [blame] | 235 | else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 236 | dev->ops = &cpu_bus_ops; |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 237 | } |
| 238 | |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 239 | /* |
| 240 | * If the PCIe root port at function 0 is disabled, |
| 241 | * the PCIe root ports might be coalesced after FSP silicon init. |
| 242 | * The below function will swap the devfn of the first enabled device |
| 243 | * in devicetree and function 0 resides a pci device |
| 244 | * so that it won't confuse coreboot. |
| 245 | */ |
| 246 | static void pcie_update_device_tree(unsigned int devfn0, int num_funcs) |
| 247 | { |
Elyes HAOUAS | 06e8315 | 2018-05-24 22:48:14 +0200 | [diff] [blame] | 248 | struct device *func0; |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 249 | unsigned int devfn; |
| 250 | int i; |
| 251 | unsigned int inc = PCI_DEVFN(0, 1); |
| 252 | |
| 253 | func0 = dev_find_slot(0, devfn0); |
| 254 | if (func0 == NULL) |
| 255 | return; |
| 256 | |
| 257 | /* No more functions if function 0 is disabled. */ |
| 258 | if (pci_read_config32(func0, PCI_VENDOR_ID) == 0xffffffff) |
| 259 | return; |
| 260 | |
| 261 | devfn = devfn0 + inc; |
| 262 | |
| 263 | /* |
| 264 | * Increase funtion by 1. |
| 265 | * Then find first enabled device to replace func0 |
| 266 | * as that port was move to func0. |
| 267 | */ |
| 268 | for (i = 1; i < num_funcs; i++, devfn += inc) { |
Elyes HAOUAS | 06e8315 | 2018-05-24 22:48:14 +0200 | [diff] [blame] | 269 | struct device *dev = dev_find_slot(0, devfn); |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 270 | if (dev == NULL) |
| 271 | continue; |
| 272 | |
| 273 | if (!dev->enabled) |
| 274 | continue; |
| 275 | /* Found the first enabled device in given dev number */ |
| 276 | func0->path.pci.devfn = dev->path.pci.devfn; |
| 277 | dev->path.pci.devfn = devfn0; |
| 278 | break; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | static void pcie_override_devicetree_after_silicon_init(void) |
| 283 | { |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 284 | pcie_update_device_tree(PCH_DEVFN_PCIE1, 4); |
| 285 | pcie_update_device_tree(PCH_DEVFN_PCIE5, 2); |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 286 | } |
| 287 | |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 288 | /* Configure package power limits */ |
| 289 | static void set_power_limits(void) |
Sumeet Pawnikar | 35240eb | 2016-08-23 11:20:20 +0530 | [diff] [blame] | 290 | { |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 291 | static struct soc_intel_apollolake_config *cfg; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 292 | struct device *dev = SA_DEV_ROOT; |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 293 | msr_t rapl_msr_reg, limit; |
| 294 | uint32_t power_unit; |
| 295 | uint32_t tdp, min_power, max_power; |
Sumeet Pawnikar | 428f90a | 2016-12-02 18:14:19 +0530 | [diff] [blame] | 296 | uint32_t pl2_val; |
Sumeet Pawnikar | 35240eb | 2016-08-23 11:20:20 +0530 | [diff] [blame] | 297 | |
Mario Scheithauer | 38b6100 | 2017-07-25 10:52:41 +0200 | [diff] [blame] | 298 | if (IS_ENABLED(CONFIG_APL_SKIP_SET_POWER_LIMITS)) { |
| 299 | printk(BIOS_INFO, "Skip the RAPL settings.\n"); |
| 300 | return; |
| 301 | } |
| 302 | |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 303 | if (!dev || !dev->chip_info) { |
| 304 | printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n"); |
| 305 | return; |
| 306 | } |
Sumeet Pawnikar | 35240eb | 2016-08-23 11:20:20 +0530 | [diff] [blame] | 307 | |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 308 | cfg = dev->chip_info; |
| 309 | |
| 310 | /* Get units */ |
| 311 | rapl_msr_reg = rdmsr(MSR_PKG_POWER_SKU_UNIT); |
| 312 | power_unit = 1 << (rapl_msr_reg.lo & 0xf); |
| 313 | |
| 314 | /* Get power defaults for this SKU */ |
| 315 | rapl_msr_reg = rdmsr(MSR_PKG_POWER_SKU); |
| 316 | tdp = rapl_msr_reg.lo & PKG_POWER_LIMIT_MASK; |
Sumeet Pawnikar | 428f90a | 2016-12-02 18:14:19 +0530 | [diff] [blame] | 317 | pl2_val = rapl_msr_reg.hi & PKG_POWER_LIMIT_MASK; |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 318 | min_power = (rapl_msr_reg.lo >> 16) & PKG_POWER_LIMIT_MASK; |
| 319 | max_power = rapl_msr_reg.hi & PKG_POWER_LIMIT_MASK; |
| 320 | |
| 321 | if (min_power > 0 && tdp < min_power) |
| 322 | tdp = min_power; |
| 323 | |
| 324 | if (max_power > 0 && tdp > max_power) |
| 325 | tdp = max_power; |
| 326 | |
| 327 | /* Set PL1 override value */ |
| 328 | tdp = (cfg->tdp_pl1_override_mw == 0) ? |
| 329 | tdp : (cfg->tdp_pl1_override_mw * power_unit) / 1000; |
Sumeet Pawnikar | 428f90a | 2016-12-02 18:14:19 +0530 | [diff] [blame] | 330 | /* Set PL2 override value */ |
| 331 | pl2_val = (cfg->tdp_pl2_override_mw == 0) ? |
| 332 | pl2_val : (cfg->tdp_pl2_override_mw * power_unit) / 1000; |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 333 | |
| 334 | /* Set long term power limit to TDP */ |
| 335 | limit.lo = tdp & PKG_POWER_LIMIT_MASK; |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 336 | /* Set PL1 Pkg Power clamp bit */ |
| 337 | limit.lo |= PKG_POWER_LIMIT_CLAMP; |
| 338 | |
| 339 | limit.lo |= PKG_POWER_LIMIT_EN; |
| 340 | limit.lo |= (MB_POWER_LIMIT1_TIME_DEFAULT & |
| 341 | PKG_POWER_LIMIT_TIME_MASK) << PKG_POWER_LIMIT_TIME_SHIFT; |
| 342 | |
Sumeet Pawnikar | 428f90a | 2016-12-02 18:14:19 +0530 | [diff] [blame] | 343 | /* Set short term power limit PL2 */ |
| 344 | limit.hi = pl2_val & PKG_POWER_LIMIT_MASK; |
| 345 | limit.hi |= PKG_POWER_LIMIT_EN; |
| 346 | |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 347 | /* Program package power limits in RAPL MSR */ |
| 348 | wrmsr(MSR_PKG_POWER_LIMIT, limit); |
| 349 | printk(BIOS_INFO, "RAPL PL1 %d.%dW\n", tdp / power_unit, |
| 350 | 100 * (tdp % power_unit) / power_unit); |
Sumeet Pawnikar | 428f90a | 2016-12-02 18:14:19 +0530 | [diff] [blame] | 351 | printk(BIOS_INFO, "RAPL PL2 %d.%dW\n", pl2_val / power_unit, |
| 352 | 100 * (pl2_val % power_unit) / power_unit); |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 353 | |
Sumeet Pawnikar | 428f90a | 2016-12-02 18:14:19 +0530 | [diff] [blame] | 354 | /* Setting RAPL MMIO register for Power limits. |
| 355 | * RAPL driver is using MSR instead of MMIO. |
| 356 | * So, disabled LIMIT_EN bit for MMIO. */ |
Subrata Banik | 208587e | 2017-05-19 18:38:24 +0530 | [diff] [blame] | 357 | MCHBAR32(MCHBAR_RAPL_PPL) = limit.lo & ~PKG_POWER_LIMIT_EN; |
| 358 | MCHBAR32(MCHBAR_RAPL_PPL + 4) = limit.hi & ~PKG_POWER_LIMIT_EN; |
Sumeet Pawnikar | 35240eb | 2016-08-23 11:20:20 +0530 | [diff] [blame] | 359 | } |
| 360 | |
Mario Scheithauer | 841416f | 2017-09-18 17:08:48 +0200 | [diff] [blame] | 361 | /* Overwrites the SCI IRQ if another IRQ number is given by device tree. */ |
| 362 | static void set_sci_irq(void) |
| 363 | { |
| 364 | static struct soc_intel_apollolake_config *cfg; |
| 365 | struct device *dev = SA_DEV_ROOT; |
| 366 | uint32_t scis; |
| 367 | |
| 368 | if (!dev || !dev->chip_info) { |
| 369 | printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n"); |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | cfg = dev->chip_info; |
| 374 | |
| 375 | /* Change only if a device tree entry exists. */ |
| 376 | if (cfg->sci_irq) { |
| 377 | scis = soc_read_sci_irq_select(); |
| 378 | scis &= ~SCI_IRQ_SEL; |
| 379 | scis |= (cfg->sci_irq << SCI_IRQ_ADJUST) & SCI_IRQ_SEL; |
| 380 | soc_write_sci_irq_select(scis); |
| 381 | } |
| 382 | } |
| 383 | |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 384 | static void soc_init(void *data) |
| 385 | { |
Lance Zhao | 1bd0c0c | 2016-04-19 18:04:21 -0700 | [diff] [blame] | 386 | struct global_nvs_t *gnvs; |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 387 | |
Aaron Durbin | 81d1e09 | 2016-07-13 01:49:10 -0500 | [diff] [blame] | 388 | /* Snapshot the current GPIO IRQ polarities. FSP is setting a |
| 389 | * default policy that doesn't honor boards' requirements. */ |
| 390 | itss_snapshot_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END); |
| 391 | |
Aaron Durbin | 6c191d8 | 2016-11-29 21:22:42 -0600 | [diff] [blame] | 392 | fsp_silicon_init(romstage_handoff_is_resume()); |
Lance Zhao | 1bd0c0c | 2016-04-19 18:04:21 -0700 | [diff] [blame] | 393 | |
Aaron Durbin | 81d1e09 | 2016-07-13 01:49:10 -0500 | [diff] [blame] | 394 | /* Restore GPIO IRQ polarities back to previous settings. */ |
| 395 | itss_restore_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END); |
| 396 | |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 397 | /* override 'enabled' setting in device tree if needed */ |
| 398 | pcie_override_devicetree_after_silicon_init(); |
| 399 | |
Aaron Durbin | fadfc2e | 2016-07-01 16:36:03 -0500 | [diff] [blame] | 400 | /* |
| 401 | * Keep the P2SB device visible so it and the other devices are |
| 402 | * visible in coreboot for driver support and PCI resource allocation. |
| 403 | * There is a UPD setting for this, but it's more consistent to use |
| 404 | * hide and unhide symmetrically. |
| 405 | */ |
| 406 | p2sb_unhide(); |
| 407 | |
Lance Zhao | 1bd0c0c | 2016-04-19 18:04:21 -0700 | [diff] [blame] | 408 | /* Allocate ACPI NVS in CBMEM */ |
| 409 | gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); |
Sumeet Pawnikar | 35240eb | 2016-08-23 11:20:20 +0530 | [diff] [blame] | 410 | |
Sumeet Pawnikar | a247d8e | 2016-09-27 23:18:35 +0530 | [diff] [blame] | 411 | /* Set RAPL MSR for Package power limits*/ |
| 412 | set_power_limits(); |
Mario Scheithauer | 841416f | 2017-09-18 17:08:48 +0200 | [diff] [blame] | 413 | |
| 414 | /* |
| 415 | * FSP-S routes SCI to IRQ 9. With the help of this function you can |
| 416 | * select another IRQ for SCI. |
| 417 | */ |
| 418 | set_sci_irq(); |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 419 | } |
| 420 | |
Andrey Petrov | 868679f | 2016-05-12 19:11:48 -0700 | [diff] [blame] | 421 | static void soc_final(void *data) |
| 422 | { |
Andrey Petrov | 3dbea29 | 2016-06-14 22:20:28 -0700 | [diff] [blame] | 423 | /* Disable global reset, just in case */ |
Shaunak Saha | 93cdc8b | 2017-04-18 15:42:09 -0700 | [diff] [blame] | 424 | pmc_global_reset_enable(0); |
Andrey Petrov | 3dbea29 | 2016-06-14 22:20:28 -0700 | [diff] [blame] | 425 | /* Make sure payload/OS can't trigger global reset */ |
Shaunak Saha | 93cdc8b | 2017-04-18 15:42:09 -0700 | [diff] [blame] | 426 | pmc_global_reset_lock(); |
Andrey Petrov | 868679f | 2016-05-12 19:11:48 -0700 | [diff] [blame] | 427 | } |
| 428 | |
Lee Leahy | bab8be2 | 2017-03-09 09:53:58 -0800 | [diff] [blame] | 429 | static void disable_dev(struct device *dev, FSP_S_CONFIG *silconfig) |
| 430 | { |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 431 | switch (dev->path.pci.devfn) { |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 432 | case PCH_DEVFN_ISH: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 433 | silconfig->IshEnable = 0; |
| 434 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 435 | case PCH_DEVFN_SATA: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 436 | silconfig->EnableSata = 0; |
| 437 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 438 | case PCH_DEVFN_PCIE5: |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 439 | silconfig->PcieRootPortEn[0] = 0; |
| 440 | silconfig->PcieRpHotPlug[0] = 0; |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 441 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 442 | case PCH_DEVFN_PCIE6: |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 443 | silconfig->PcieRootPortEn[1] = 0; |
| 444 | silconfig->PcieRpHotPlug[1] = 0; |
| 445 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 446 | case PCH_DEVFN_PCIE1: |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 447 | silconfig->PcieRootPortEn[2] = 0; |
| 448 | silconfig->PcieRpHotPlug[2] = 0; |
| 449 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 450 | case PCH_DEVFN_PCIE2: |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 451 | silconfig->PcieRootPortEn[3] = 0; |
| 452 | silconfig->PcieRpHotPlug[3] = 0; |
| 453 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 454 | case PCH_DEVFN_PCIE3: |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 455 | silconfig->PcieRootPortEn[4] = 0; |
| 456 | silconfig->PcieRpHotPlug[4] = 0; |
| 457 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 458 | case PCH_DEVFN_PCIE4: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 459 | silconfig->PcieRootPortEn[5] = 0; |
Kane Chen | d779605 | 2016-07-11 12:17:13 +0800 | [diff] [blame] | 460 | silconfig->PcieRpHotPlug[5] = 0; |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 461 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 462 | case PCH_DEVFN_XHCI: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 463 | silconfig->Usb30Mode = 0; |
| 464 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 465 | case PCH_DEVFN_XDCI: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 466 | silconfig->UsbOtg = 0; |
| 467 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 468 | case PCH_DEVFN_I2C0: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 469 | silconfig->I2c0Enable = 0; |
| 470 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 471 | case PCH_DEVFN_I2C1: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 472 | silconfig->I2c1Enable = 0; |
| 473 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 474 | case PCH_DEVFN_I2C2: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 475 | silconfig->I2c2Enable = 0; |
| 476 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 477 | case PCH_DEVFN_I2C3: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 478 | silconfig->I2c3Enable = 0; |
| 479 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 480 | case PCH_DEVFN_I2C4: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 481 | silconfig->I2c4Enable = 0; |
| 482 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 483 | case PCH_DEVFN_I2C5: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 484 | silconfig->I2c5Enable = 0; |
| 485 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 486 | case PCH_DEVFN_I2C6: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 487 | silconfig->I2c6Enable = 0; |
| 488 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 489 | case PCH_DEVFN_I2C7: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 490 | silconfig->I2c7Enable = 0; |
| 491 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 492 | case PCH_DEVFN_UART0: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 493 | silconfig->Hsuart0Enable = 0; |
| 494 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 495 | case PCH_DEVFN_UART1: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 496 | silconfig->Hsuart1Enable = 0; |
| 497 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 498 | case PCH_DEVFN_UART2: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 499 | silconfig->Hsuart2Enable = 0; |
| 500 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 501 | case PCH_DEVFN_UART3: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 502 | silconfig->Hsuart3Enable = 0; |
| 503 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 504 | case PCH_DEVFN_SPI0: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 505 | silconfig->Spi0Enable = 0; |
| 506 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 507 | case PCH_DEVFN_SPI1: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 508 | silconfig->Spi1Enable = 0; |
| 509 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 510 | case PCH_DEVFN_SPI2: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 511 | silconfig->Spi2Enable = 0; |
| 512 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 513 | case PCH_DEVFN_SDCARD: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 514 | silconfig->SdcardEnabled = 0; |
| 515 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 516 | case PCH_DEVFN_EMMC: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 517 | silconfig->eMMCEnabled = 0; |
| 518 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 519 | case PCH_DEVFN_SDIO: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 520 | silconfig->SdioEnabled = 0; |
| 521 | break; |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 522 | case PCH_DEVFN_SMBUS: |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 523 | silconfig->SmbusEnable = 0; |
| 524 | break; |
Werner Zeh | de3ace0 | 2019-01-15 08:03:43 +0100 | [diff] [blame] | 525 | #if !IS_ENABLED(CONFIG_SOC_INTEL_GLK) |
| 526 | case SA_DEVFN_IPU: |
| 527 | silconfig->IpuEn = 0; |
| 528 | break; |
| 529 | #endif |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 530 | default: |
| 531 | printk(BIOS_WARNING, "PCI:%02x.%01x: Could not disable the device\n", |
| 532 | PCI_SLOT(dev->path.pci.devfn), |
| 533 | PCI_FUNC(dev->path.pci.devfn)); |
| 534 | break; |
| 535 | } |
| 536 | } |
| 537 | |
Brandon Breitenstein | c31ba0e | 2016-07-27 17:34:45 -0700 | [diff] [blame] | 538 | static void parse_devicetree(FSP_S_CONFIG *silconfig) |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 539 | { |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 540 | struct device *dev = SA_DEV_ROOT; |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 541 | |
| 542 | if (!dev) { |
| 543 | printk(BIOS_ERR, "Could not find root device\n"); |
| 544 | return; |
| 545 | } |
| 546 | /* Only disable bus 0 devices. */ |
| 547 | for (dev = dev->bus->children; dev; dev = dev->sibling) { |
| 548 | if (!dev->enabled) |
| 549 | disable_dev(dev, silconfig); |
| 550 | } |
| 551 | } |
| 552 | |
Hannah Williams | 3ff14a0 | 2017-05-05 16:30:22 -0700 | [diff] [blame] | 553 | static void apl_fsp_silicon_init_params_cb(struct soc_intel_apollolake_config |
| 554 | *cfg, FSP_S_CONFIG *silconfig) |
| 555 | { |
| 556 | #if !IS_ENABLED(CONFIG_SOC_INTEL_GLK) /* GLK FSP does not have these |
| 557 | fields in FspsUpd.h yet */ |
| 558 | uint8_t port; |
| 559 | |
| 560 | for (port = 0; port < APOLLOLAKE_USB2_PORT_MAX; port++) { |
| 561 | if (cfg->usb2eye[port].Usb20PerPortTxPeHalf != 0) |
| 562 | silconfig->PortUsb20PerPortTxPeHalf[port] = |
| 563 | cfg->usb2eye[port].Usb20PerPortTxPeHalf; |
| 564 | |
| 565 | if (cfg->usb2eye[port].Usb20PerPortPeTxiSet != 0) |
| 566 | silconfig->PortUsb20PerPortPeTxiSet[port] = |
| 567 | cfg->usb2eye[port].Usb20PerPortPeTxiSet; |
| 568 | |
| 569 | if (cfg->usb2eye[port].Usb20PerPortTxiSet != 0) |
| 570 | silconfig->PortUsb20PerPortTxiSet[port] = |
| 571 | cfg->usb2eye[port].Usb20PerPortTxiSet; |
| 572 | |
| 573 | if (cfg->usb2eye[port].Usb20HsSkewSel != 0) |
| 574 | silconfig->PortUsb20HsSkewSel[port] = |
| 575 | cfg->usb2eye[port].Usb20HsSkewSel; |
| 576 | |
| 577 | if (cfg->usb2eye[port].Usb20IUsbTxEmphasisEn != 0) |
| 578 | silconfig->PortUsb20IUsbTxEmphasisEn[port] = |
| 579 | cfg->usb2eye[port].Usb20IUsbTxEmphasisEn; |
| 580 | |
| 581 | if (cfg->usb2eye[port].Usb20PerPortRXISet != 0) |
| 582 | silconfig->PortUsb20PerPortRXISet[port] = |
| 583 | cfg->usb2eye[port].Usb20PerPortRXISet; |
| 584 | |
| 585 | if (cfg->usb2eye[port].Usb20HsNpreDrvSel != 0) |
| 586 | silconfig->PortUsb20HsNpreDrvSel[port] = |
| 587 | cfg->usb2eye[port].Usb20HsNpreDrvSel; |
| 588 | } |
| 589 | #endif |
| 590 | } |
| 591 | |
| 592 | static void glk_fsp_silicon_init_params_cb( |
| 593 | struct soc_intel_apollolake_config *cfg, FSP_S_CONFIG *silconfig) |
| 594 | { |
Srinidhi N Kaushik | 5af546c | 2018-05-14 23:33:55 -0700 | [diff] [blame] | 595 | #if IS_ENABLED(CONFIG_SOC_INTEL_GLK) |
Hannah Williams | 3ff14a0 | 2017-05-05 16:30:22 -0700 | [diff] [blame] | 596 | silconfig->Gmm = 0; |
Shamile Khan | c4276a3 | 2018-03-14 18:09:19 -0700 | [diff] [blame] | 597 | |
| 598 | /* On Geminilake, we need to override the default FSP PCIe de-emphasis |
| 599 | * settings using the device tree settings. This is because PCIe |
| 600 | * de-emphasis is enabled by default and Thunderpeak PCIe WiFi detection |
| 601 | * requires de-emphasis disabled. If we make this change common to both |
| 602 | * Apollolake and Geminilake, then we need to add mainboard device tree |
| 603 | * de-emphasis settings of 1 to Apollolake systems. |
| 604 | */ |
| 605 | memcpy(silconfig->PcieRpSelectableDeemphasis, |
| 606 | cfg->pcie_rp_deemphasis_enable, |
| 607 | sizeof(silconfig->PcieRpSelectableDeemphasis)); |
Srinidhi N Kaushik | 5af546c | 2018-05-14 23:33:55 -0700 | [diff] [blame] | 608 | /* |
| 609 | * FSP does not know what the clock requirements are for the |
| 610 | * device on SPI bus, hence it should not modify what coreboot |
| 611 | * has set up. Hence skipping in FSP. |
| 612 | */ |
| 613 | silconfig->SkipSpiPCP = 1; |
John Zhao | e673e5c | 2018-10-30 15:12:11 -0700 | [diff] [blame] | 614 | |
| 615 | /* |
| 616 | * FSP provides UPD interface to execute IPC command. In order to |
| 617 | * improve boot performance, configure PmicPmcIpcCtrl for PMC to program |
| 618 | * PMIC PCH_PWROK delay. |
John Zhao | 91600a3 | 2019-01-10 12:13:38 -0800 | [diff] [blame] | 619 | */ |
John Zhao | e673e5c | 2018-10-30 15:12:11 -0700 | [diff] [blame] | 620 | silconfig->PmicPmcIpcCtrl = cfg->PmicPmcIpcCtrl; |
John Zhao | 91600a3 | 2019-01-10 12:13:38 -0800 | [diff] [blame] | 621 | |
| 622 | /* |
| 623 | * Options to disable XHCI Link Compliance Mode. |
| 624 | */ |
| 625 | silconfig->DisableComplianceMode = cfg->DisableComplianceMode; |
Srinidhi N Kaushik | 5af546c | 2018-05-14 23:33:55 -0700 | [diff] [blame] | 626 | #endif |
Hannah Williams | 3ff14a0 | 2017-05-05 16:30:22 -0700 | [diff] [blame] | 627 | } |
| 628 | |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 629 | void __weak mainboard_devtree_update(struct device *dev) |
Kane Chen | 5bddcc4 | 2017-08-22 11:37:18 +0800 | [diff] [blame] | 630 | { |
Elyes HAOUAS | 88607a4 | 2018-10-05 10:36:45 +0200 | [diff] [blame] | 631 | /* Override dev tree settings per board */ |
Kane Chen | 5bddcc4 | 2017-08-22 11:37:18 +0800 | [diff] [blame] | 632 | } |
| 633 | |
Brandon Breitenstein | c31ba0e | 2016-07-27 17:34:45 -0700 | [diff] [blame] | 634 | void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd) |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 635 | { |
Lee Leahy | 1d20fe7 | 2017-03-09 09:50:28 -0800 | [diff] [blame] | 636 | FSP_S_CONFIG *silconfig = &silupd->FspsConfig; |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 637 | static struct soc_intel_apollolake_config *cfg; |
| 638 | |
| 639 | /* Load VBT before devicetree-specific config. */ |
Patrick Georgi | 2257959 | 2017-10-06 17:36:09 +0200 | [diff] [blame] | 640 | silconfig->GraphicsConfigPtr = (uintptr_t)vbt_get(); |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 641 | |
Subrata Banik | 2ee54db | 2017-03-05 12:37:00 +0530 | [diff] [blame] | 642 | struct device *dev = SA_DEV_ROOT; |
Andrey Petrov | 78461a9 | 2016-06-28 12:14:33 -0700 | [diff] [blame] | 643 | |
Patrick Georgi | 831d65d | 2016-04-14 11:53:48 +0200 | [diff] [blame] | 644 | if (!dev || !dev->chip_info) { |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 645 | printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n"); |
| 646 | return; |
| 647 | } |
| 648 | |
Kane Chen | 5bddcc4 | 2017-08-22 11:37:18 +0800 | [diff] [blame] | 649 | mainboard_devtree_update(dev); |
| 650 | |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 651 | cfg = dev->chip_info; |
| 652 | |
Jagadish Krishnamoorthy | b023e5e | 2016-06-22 18:32:17 -0700 | [diff] [blame] | 653 | /* Parse device tree and disable unused device*/ |
| 654 | parse_devicetree(silconfig); |
| 655 | |
Furquan Shaikh | 6d5e10c | 2018-03-14 19:57:16 -0700 | [diff] [blame] | 656 | memcpy(silconfig->PcieRpClkReqNumber, cfg->pcie_rp_clkreq_pin, |
| 657 | sizeof(silconfig->PcieRpClkReqNumber)); |
Andrey Petrov | e07e13d | 2016-03-18 14:43:00 -0700 | [diff] [blame] | 658 | |
Furquan Shaikh | 2cfc862 | 2018-03-14 21:43:04 -0700 | [diff] [blame] | 659 | memcpy(silconfig->PcieRpHotPlug, cfg->pcie_rp_hotplug_enable, |
| 660 | sizeof(silconfig->PcieRpHotPlug)); |
| 661 | |
Nico Huber | 8885529 | 2018-11-27 15:13:22 +0100 | [diff] [blame] | 662 | switch (cfg->serirq_mode) { |
| 663 | case SERIRQ_QUIET: |
| 664 | silconfig->SirqEnable = 1; |
| 665 | silconfig->SirqMode = 0; |
| 666 | break; |
| 667 | case SERIRQ_CONTINUOUS: |
| 668 | silconfig->SirqEnable = 1; |
| 669 | silconfig->SirqMode = 1; |
| 670 | break; |
| 671 | case SERIRQ_OFF: |
| 672 | default: |
| 673 | silconfig->SirqEnable = 0; |
| 674 | break; |
| 675 | } |
| 676 | |
Zhao, Lijian | 1b8ee0b | 2016-05-17 19:01:34 -0700 | [diff] [blame] | 677 | if (cfg->emmc_tx_cmd_cntl != 0) |
| 678 | silconfig->EmmcTxCmdCntl = cfg->emmc_tx_cmd_cntl; |
| 679 | if (cfg->emmc_tx_data_cntl1 != 0) |
| 680 | silconfig->EmmcTxDataCntl1 = cfg->emmc_tx_data_cntl1; |
| 681 | if (cfg->emmc_tx_data_cntl2 != 0) |
| 682 | silconfig->EmmcTxDataCntl2 = cfg->emmc_tx_data_cntl2; |
| 683 | if (cfg->emmc_rx_cmd_data_cntl1 != 0) |
| 684 | silconfig->EmmcRxCmdDataCntl1 = cfg->emmc_rx_cmd_data_cntl1; |
| 685 | if (cfg->emmc_rx_strobe_cntl != 0) |
| 686 | silconfig->EmmcRxStrobeCntl = cfg->emmc_rx_strobe_cntl; |
| 687 | if (cfg->emmc_rx_cmd_data_cntl2 != 0) |
| 688 | silconfig->EmmcRxCmdDataCntl2 = cfg->emmc_rx_cmd_data_cntl2; |
Mario Scheithauer | 9116eb6 | 2018-08-23 11:39:19 +0200 | [diff] [blame] | 689 | if (cfg->emmc_host_max_speed != 0) |
| 690 | silconfig->eMMCHostMaxSpeed = cfg->emmc_host_max_speed; |
Zhao, Lijian | 1b8ee0b | 2016-05-17 19:01:34 -0700 | [diff] [blame] | 691 | |
Saurabh Satija | e46dbcc | 2016-05-03 15:15:31 -0700 | [diff] [blame] | 692 | silconfig->LPSS_S0ixEnable = cfg->lpss_s0ix_enable; |
| 693 | |
Lee Leahy | 07441b5 | 2017-03-09 10:59:25 -0800 | [diff] [blame] | 694 | /* Disable monitor mwait since it is broken due to a hardware bug |
Cole Nelson | f357c25 | 2017-05-16 11:38:59 -0700 | [diff] [blame] | 695 | * without a fix. Specific to Apollolake. |
Lee Leahy | 07441b5 | 2017-03-09 10:59:25 -0800 | [diff] [blame] | 696 | */ |
Cole Nelson | f357c25 | 2017-05-16 11:38:59 -0700 | [diff] [blame] | 697 | if (!IS_ENABLED(CONFIG_SOC_INTEL_GLK)) |
| 698 | silconfig->MonitorMwaitEnable = 0; |
Bora Guvendik | 60cc75d | 2016-07-25 14:44:51 -0700 | [diff] [blame] | 699 | |
Subrata Banik | f699c14 | 2018-06-08 17:57:37 +0530 | [diff] [blame] | 700 | silconfig->SkipMpInit = !chip_get_fsp_mp_init(); |
Venkateswarlu Vinjamuri | 1a5e32c | 2016-10-31 17:15:30 -0700 | [diff] [blame] | 701 | |
Furquan Shaikh | cad9b63 | 2016-06-20 16:08:42 -0700 | [diff] [blame] | 702 | /* Disable setting of EISS bit in FSP. */ |
| 703 | silconfig->SpiEiss = 0; |
Ravi Sarawadi | 3a21d0f | 2016-08-10 11:33:56 -0700 | [diff] [blame] | 704 | |
| 705 | /* Disable FSP from locking access to the RTC NVRAM */ |
| 706 | silconfig->RtcLock = 0; |
Venkateswarlu Vinjamuri | 88df48c | 2016-09-02 16:04:27 -0700 | [diff] [blame] | 707 | |
| 708 | /* Enable Audio clk gate and power gate */ |
| 709 | silconfig->HDAudioClkGate = cfg->hdaudio_clk_gate_enable; |
| 710 | silconfig->HDAudioPwrGate = cfg->hdaudio_pwr_gate_enable; |
| 711 | /* Bios config lockdown Audio clk and power gate */ |
| 712 | silconfig->BiosCfgLockDown = cfg->hdaudio_bios_config_lockdown; |
Hannah Williams | 3ff14a0 | 2017-05-05 16:30:22 -0700 | [diff] [blame] | 713 | if (IS_ENABLED(CONFIG_SOC_INTEL_GLK)) |
| 714 | glk_fsp_silicon_init_params_cb(cfg, silconfig); |
| 715 | else |
| 716 | apl_fsp_silicon_init_params_cb(cfg, silconfig); |
Duncan Laurie | 4c8fbc0 | 2018-03-26 02:19:58 -0700 | [diff] [blame] | 717 | |
| 718 | /* Enable xDCI controller if enabled in devicetree and allowed */ |
| 719 | dev = dev_find_slot(0, PCH_DEVFN_XDCI); |
| 720 | if (!xdci_can_enable()) |
| 721 | dev->enabled = 0; |
| 722 | silconfig->UsbOtg = dev->enabled; |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 723 | } |
| 724 | |
| 725 | struct chip_operations soc_intel_apollolake_ops = { |
| 726 | CHIP_NAME("Intel Apollolake SOC") |
John Zhao | 57aa8b6 | 2019-01-14 09:15:50 -0800 | [diff] [blame] | 727 | .enable_dev = &enable_dev, |
| 728 | .init = &soc_init, |
| 729 | .final = &soc_final |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 730 | }; |
| 731 | |
Andrey Petrov | a697c19 | 2016-12-07 10:47:46 -0800 | [diff] [blame] | 732 | static void drop_privilege_all(void) |
| 733 | { |
| 734 | /* Drop privilege level on all the CPUs */ |
Subrata Banik | 3337497 | 2018-04-24 13:45:30 +0530 | [diff] [blame] | 735 | if (mp_run_on_all_cpus(&cpu_enable_untrusted_mode, NULL, 1000) < 0) |
Andrey Petrov | a697c19 | 2016-12-07 10:47:46 -0800 | [diff] [blame] | 736 | printk(BIOS_ERR, "failed to enable untrusted mode\n"); |
| 737 | } |
| 738 | |
John Zhao | 7dff726 | 2018-07-30 13:54:25 -0700 | [diff] [blame] | 739 | static void configure_xhci_host_mode_port0(void) |
| 740 | { |
| 741 | uint32_t *cfg0; |
| 742 | uint32_t *cfg1; |
| 743 | const struct resource *res; |
| 744 | uint32_t reg; |
| 745 | struct stopwatch sw; |
| 746 | struct device *xhci_dev = PCH_DEV_XHCI; |
| 747 | |
| 748 | printk(BIOS_INFO, "Putting xHCI port 0 into host mode.\n"); |
| 749 | res = find_resource(xhci_dev, PCI_BASE_ADDRESS_0); |
| 750 | cfg0 = (void *)(uintptr_t)(res->base + DUAL_ROLE_CFG0); |
| 751 | cfg1 = (void *)(uintptr_t)(res->base + DUAL_ROLE_CFG1); |
| 752 | reg = read32(cfg0); |
John Zhao | db2f91b | 2018-08-21 15:02:54 -0700 | [diff] [blame] | 753 | if (!(reg & SW_IDPIN_EN_MASK)) |
John Zhao | 7dff726 | 2018-07-30 13:54:25 -0700 | [diff] [blame] | 754 | return; |
| 755 | |
| 756 | reg &= ~(SW_IDPIN_MASK | SW_VBUS_VALID_MASK); |
| 757 | write32(cfg0, reg); |
| 758 | |
| 759 | stopwatch_init_msecs_expire(&sw, 10); |
| 760 | /* Wait for the host mode status bit. */ |
| 761 | while ((read32(cfg1) & DRD_MODE_MASK) != DRD_MODE_HOST) { |
| 762 | if (stopwatch_expired(&sw)) { |
| 763 | printk(BIOS_ERR, "Timed out waiting for host mode.\n"); |
| 764 | return; |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | printk(BIOS_INFO, "xHCI port 0 host switch over took %lu ms\n", |
| 769 | stopwatch_duration_msecs(&sw)); |
| 770 | } |
| 771 | |
| 772 | static int check_xdci_enable(void) |
| 773 | { |
| 774 | struct device *dev = PCH_DEV_XDCI; |
| 775 | |
| 776 | return !!dev->enabled; |
| 777 | } |
| 778 | |
Lee Leahy | 806fa24 | 2016-08-01 13:55:02 -0700 | [diff] [blame] | 779 | void platform_fsp_notify_status(enum fsp_notify_phase phase) |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 780 | { |
Andrey Petrov | a697c19 | 2016-12-07 10:47:46 -0800 | [diff] [blame] | 781 | if (phase == END_OF_FIRMWARE) { |
Furquan Shaikh | d2c2f83 | 2018-11-07 10:24:31 -0800 | [diff] [blame] | 782 | |
| 783 | /* |
| 784 | * Before hiding P2SB device and dropping privilege level, |
| 785 | * dump CSE status and disable HECI1 interface. |
| 786 | */ |
| 787 | heci_cse_lockdown(); |
| 788 | |
Andrey Petrov | a697c19 | 2016-12-07 10:47:46 -0800 | [diff] [blame] | 789 | /* Hide the P2SB device to align with previous behavior. */ |
Aaron Durbin | fadfc2e | 2016-07-01 16:36:03 -0500 | [diff] [blame] | 790 | p2sb_hide(); |
Furquan Shaikh | d2c2f83 | 2018-11-07 10:24:31 -0800 | [diff] [blame] | 791 | |
Andrey Petrov | a697c19 | 2016-12-07 10:47:46 -0800 | [diff] [blame] | 792 | /* |
| 793 | * As per guidelines BIOS is recommended to drop CPU privilege |
| 794 | * level to IA_UNTRUSTED. After that certain device registers |
| 795 | * and MSRs become inaccessible supposedly increasing system |
| 796 | * security. |
| 797 | */ |
| 798 | drop_privilege_all(); |
John Zhao | 7dff726 | 2018-07-30 13:54:25 -0700 | [diff] [blame] | 799 | |
| 800 | /* |
| 801 | * When USB OTG is set, GLK FSP enables xHCI SW ID pin and |
| 802 | * configures USB-C as device mode. Force USB-C into host mode. |
| 803 | */ |
| 804 | if (check_xdci_enable()) |
| 805 | configure_xhci_host_mode_port0(); |
John Zhao | 57aa8b6 | 2019-01-14 09:15:50 -0800 | [diff] [blame] | 806 | |
| 807 | /* |
| 808 | * Override GLK xhci clock gating register(XHCLKGTEN) to |
| 809 | * mitigate usb device suspend and resume failure. |
| 810 | */ |
| 811 | if (IS_ENABLED(CONFIG_SOC_INTEL_GLK)) { |
| 812 | uint32_t *cfg; |
| 813 | const struct resource *res; |
| 814 | uint32_t reg; |
| 815 | struct device *xhci_dev = PCH_DEV_XHCI; |
| 816 | |
| 817 | res = find_resource(xhci_dev, PCI_BASE_ADDRESS_0); |
| 818 | cfg = (void *)(uintptr_t)(res->base + CFG_XHCLKGTEN); |
| 819 | reg = SRAMPGTEN | SSLSE | USB2PLLSE | IOSFSTCGE | |
| 820 | HSTCGE | HSUXDMIPLLSE | SSTCGE | XHCFTCLKSE | |
| 821 | XHCBBTCGIPISO | XHCUSB2PLLSDLE | SSPLLSUE | |
| 822 | XHCBLCGE | HSLTCGE | SSLTCGE | IOSFBTCGE | |
| 823 | IOSFGBLCGE; |
| 824 | write32(cfg, reg); |
| 825 | } |
Andrey Petrov | a697c19 | 2016-12-07 10:47:46 -0800 | [diff] [blame] | 826 | } |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 827 | } |
| 828 | |
Furquan Shaikh | 6ac226d | 2016-06-15 17:13:20 -0700 | [diff] [blame] | 829 | /* |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 830 | * spi_flash init() needs to run unconditionally on every boot (including |
| 831 | * resume) to allow write protect to be disabled for eventlog and nvram |
| 832 | * updates. This needs to be done as early as possible in ramstage. Thus, add a |
| 833 | * callback for entry into BS_PRE_DEVICE. |
Furquan Shaikh | 6ac226d | 2016-06-15 17:13:20 -0700 | [diff] [blame] | 834 | */ |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 835 | static void spi_flash_init_cb(void *unused) |
Furquan Shaikh | 6ac226d | 2016-06-15 17:13:20 -0700 | [diff] [blame] | 836 | { |
Barnali Sarkar | e70142c | 2017-03-28 16:32:33 +0530 | [diff] [blame] | 837 | fast_spi_init(); |
Furquan Shaikh | 6ac226d | 2016-06-15 17:13:20 -0700 | [diff] [blame] | 838 | } |
| 839 | |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 840 | BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, spi_flash_init_cb, NULL); |