Simon Glass | 471e28c | 2019-12-08 17:40:10 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright 2019 Google LLC |
| 4 | */ |
| 5 | |
Simon Glass | 471e28c | 2019-12-08 17:40:10 -0700 | [diff] [blame] | 6 | #include <dm.h> |
| 7 | #include <pch.h> |
| 8 | #include <spl.h> |
| 9 | #include <asm/lpc_common.h> |
| 10 | |
| 11 | #define BIOS_CTRL 0xdc |
| 12 | |
| 13 | static int apl_set_spi_protect(struct udevice *dev, bool protect) |
| 14 | { |
| 15 | if (spl_phase() == PHASE_SPL) |
| 16 | return lpc_set_spi_protect(dev, BIOS_CTRL, protect); |
| 17 | |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | static const struct pch_ops apl_pch_ops = { |
| 22 | .set_spi_protect = apl_set_spi_protect, |
| 23 | }; |
| 24 | |
Simon Glass | 9288265 | 2021-08-07 07:24:04 -0600 | [diff] [blame] | 25 | #if CONFIG_IS_ENABLED(OF_REAL) |
Simon Glass | 471e28c | 2019-12-08 17:40:10 -0700 | [diff] [blame] | 26 | static const struct udevice_id apl_pch_ids[] = { |
| 27 | { .compatible = "intel,apl-pch" }, |
| 28 | { } |
| 29 | }; |
Simon Glass | ec8ae8a | 2020-12-23 08:11:30 -0700 | [diff] [blame] | 30 | #endif |
Simon Glass | 471e28c | 2019-12-08 17:40:10 -0700 | [diff] [blame] | 31 | |
Simon Glass | a055da8 | 2020-10-05 05:27:01 -0600 | [diff] [blame] | 32 | U_BOOT_DRIVER(intel_apl_pch) = { |
| 33 | .name = "intel_apl_pch", |
Simon Glass | 471e28c | 2019-12-08 17:40:10 -0700 | [diff] [blame] | 34 | .id = UCLASS_PCH, |
Simon Glass | ec8ae8a | 2020-12-23 08:11:30 -0700 | [diff] [blame] | 35 | .of_match = of_match_ptr(apl_pch_ids), |
Simon Glass | 471e28c | 2019-12-08 17:40:10 -0700 | [diff] [blame] | 36 | .ops = &apl_pch_ops, |
| 37 | }; |