blob: a0f9b031dea31d74f129ec3c0e2249648f595bfd [file] [log] [blame]
Simon Glass471e28c2019-12-08 17:40:10 -07001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2019 Google LLC
4 */
5
6#include <common.h>
7#include <dm.h>
8#include <pch.h>
9#include <spl.h>
10#include <asm/lpc_common.h>
11
12#define BIOS_CTRL 0xdc
13
14static int apl_set_spi_protect(struct udevice *dev, bool protect)
15{
16 if (spl_phase() == PHASE_SPL)
17 return lpc_set_spi_protect(dev, BIOS_CTRL, protect);
18
19 return 0;
20}
21
22static const struct pch_ops apl_pch_ops = {
23 .set_spi_protect = apl_set_spi_protect,
24};
25
Simon Glass92882652021-08-07 07:24:04 -060026#if CONFIG_IS_ENABLED(OF_REAL)
Simon Glass471e28c2019-12-08 17:40:10 -070027static const struct udevice_id apl_pch_ids[] = {
28 { .compatible = "intel,apl-pch" },
29 { }
30};
Simon Glassec8ae8a2020-12-23 08:11:30 -070031#endif
Simon Glass471e28c2019-12-08 17:40:10 -070032
Simon Glassa055da82020-10-05 05:27:01 -060033U_BOOT_DRIVER(intel_apl_pch) = {
34 .name = "intel_apl_pch",
Simon Glass471e28c2019-12-08 17:40:10 -070035 .id = UCLASS_PCH,
Simon Glassec8ae8a2020-12-23 08:11:30 -070036 .of_match = of_match_ptr(apl_pch_ids),
Simon Glass471e28c2019-12-08 17:40:10 -070037 .ops = &apl_pch_ops,
38};