1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2016 Google, Inc
5 * From coreboot broadwell support
12 #include <asm/global_data.h>
13 #include <asm/intel_regs.h>
15 #include <asm/lpc_common.h>
16 #include <asm/arch/pch.h>
17 #include <asm/arch/spi.h>
19 static void set_spi_speed(void)
24 /* Observe SPI Descriptor Component Section 0 */
25 writel(0x1000, SPI_REG(SPIBAR_FDOC));
27 /* Extract the Write/Erase SPI Frequency from descriptor */
28 fdod = readl(SPI_REG(SPIBAR_FDOD));
32 /* Set Software Sequence frequency to match */
33 ssfc = readb(SPI_REG(SPIBAR_SSFC + 2));
36 writeb(ssfc, SPI_REG(SPIBAR_SSFC + 2));
39 static int broadwell_lpc_early_init(struct udevice *dev)
46 static int lpc_init_extra(struct udevice *dev)
51 static int broadwell_lpc_probe(struct udevice *dev)
55 if (!(gd->flags & GD_FLG_RELOC)) {
56 ret = lpc_common_early_init(dev);
58 debug("%s: lpc_early_init() failed\n", __func__);
62 return broadwell_lpc_early_init(dev);
65 return lpc_init_extra(dev);
68 static const struct udevice_id broadwell_lpc_ids[] = {
69 { .compatible = "intel,broadwell-lpc" },
73 U_BOOT_DRIVER(broadwell_lpc_drv) = {
76 .of_match = broadwell_lpc_ids,
77 .probe = broadwell_lpc_probe,