blob: 1a5a985221f18a3779d8655aecef562f5ba57007 [file] [log] [blame]
Simon Glass40fb08e2019-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
26static const struct udevice_id apl_pch_ids[] = {
27 { .compatible = "intel,apl-pch" },
28 { }
29};
30
31U_BOOT_DRIVER(apl_pch) = {
32 .name = "apl_pch",
33 .id = UCLASS_PCH,
34 .of_match = apl_pch_ids,
35 .ops = &apl_pch_ops,
36};