2 * Copyright (c) 2016 Google, Inc
4 * From coreboot broadwell support
6 * SPDX-License-Identifier: GPL-2.0
12 #include <asm/intel_regs.h>
14 #include <asm/lpc_common.h>
15 #include <asm/arch/pch.h>
16 #include <asm/arch/spi.h>
18 static void set_spi_speed(void)
23 /* Observe SPI Descriptor Component Section 0 */
24 writel(0x1000, SPI_REG(SPIBAR_FDOC));
26 /* Extract the Write/Erase SPI Frequency from descriptor */
27 fdod = readl(SPI_REG(SPIBAR_FDOD));
31 /* Set Software Sequence frequency to match */
32 ssfc = readb(SPI_REG(SPIBAR_SSFC + 2));
35 writeb(ssfc, SPI_REG(SPIBAR_SSFC + 2));
38 static int broadwell_lpc_early_init(struct udevice *dev)
45 static int lpc_init_extra(struct udevice *dev)
50 static int broadwell_lpc_probe(struct udevice *dev)
54 if (!(gd->flags & GD_FLG_RELOC)) {
55 ret = lpc_common_early_init(dev);
57 debug("%s: lpc_early_init() failed\n", __func__);
61 return broadwell_lpc_early_init(dev);
64 return lpc_init_extra(dev);
67 static const struct udevice_id broadwell_lpc_ids[] = {
68 { .compatible = "intel,broadwell-lpc" },
72 U_BOOT_DRIVER(broadwell_lpc_drv) = {
75 .of_match = broadwell_lpc_ids,
76 .probe = broadwell_lpc_probe,