blob: 32190312ff8cd879bddb704cac5ef69522cbf49f [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
Simon Glass471e28c2019-12-08 17:40:10 -07006#include <dm.h>
7#include <pch.h>
8#include <spl.h>
9#include <asm/lpc_common.h>
10
11#define BIOS_CTRL 0xdc
12
13static 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
21static const struct pch_ops apl_pch_ops = {
22 .set_spi_protect = apl_set_spi_protect,
23};
24
Simon Glass92882652021-08-07 07:24:04 -060025#if CONFIG_IS_ENABLED(OF_REAL)
Simon Glass471e28c2019-12-08 17:40:10 -070026static const struct udevice_id apl_pch_ids[] = {
27 { .compatible = "intel,apl-pch" },
28 { }
29};
Simon Glassec8ae8a2020-12-23 08:11:30 -070030#endif
Simon Glass471e28c2019-12-08 17:40:10 -070031
Simon Glassa055da82020-10-05 05:27:01 -060032U_BOOT_DRIVER(intel_apl_pch) = {
33 .name = "intel_apl_pch",
Simon Glass471e28c2019-12-08 17:40:10 -070034 .id = UCLASS_PCH,
Simon Glassec8ae8a2020-12-23 08:11:30 -070035 .of_match = of_match_ptr(apl_pch_ids),
Simon Glass471e28c2019-12-08 17:40:10 -070036 .ops = &apl_pch_ops,
37};