summaryrefslogtreecommitdiff
path: root/arch/x86/cpu/intel_common/lpss.c
blob: 26a2d2d1e36d9e0a270cf1153f14ca227a221a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-License-Identifier: GPL-2.0
/*
 * Special driver to handle of-platdata
 *
 * Copyright 2019 Google LLC
 *
 * Some code from coreboot lpss.c
 */

#include <common.h>
#include <dm.h>
#include <pci.h>
#include <asm/io.h>
#include <asm/lpss.h>

enum {
	LPSS_RESET_CTL_REG	= 0x204,

	/*
	 * Bit 1:0 controls LPSS controller reset.
	 *
	 * 00 ->LPSS Host Controller is in reset (Reset Asserted)
	 * 01/10 ->Reserved
	 * 11 ->LPSS Host Controller is NOT at reset (Reset Released)
	 */
	LPSS_CNT_RST_RELEASE	= 3,

	/* Power management control and status register */
	PME_CTRL_STATUS		= 0x84,

	/* Bit 1:0 Powerstate, controls D0 and D3 state */
	POWER_STATE_MASK	= 3,
};

/* Take controller out of reset */
void lpss_reset_release(void *regs)
{
	writel(LPSS_CNT_RST_RELEASE, regs + LPSS_RESET_CTL_REG);
}

void lpss_set_power_state(struct udevice *dev, enum lpss_pwr_state state)
{
	dm_pci_clrset_config8(dev, PME_CTRL_STATUS, POWER_STATE_MASK, state);
}