mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
x86: apl: Support set_hide() in p2sb driver
Add support for this new method in the driver and in the fsp-s setup. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Tested-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <irq.h>
|
#include <irq.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <p2sb.h>
|
||||||
#include <acpi/acpi_s3.h>
|
#include <acpi/acpi_s3.h>
|
||||||
#include <asm/intel_pinctrl.h>
|
#include <asm/intel_pinctrl.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
@@ -21,10 +22,11 @@
|
|||||||
#include <asm/pci.h>
|
#include <asm/pci.h>
|
||||||
#include <asm/arch/cpu.h>
|
#include <asm/arch/cpu.h>
|
||||||
#include <asm/arch/systemagent.h>
|
#include <asm/arch/systemagent.h>
|
||||||
|
#include <asm/arch/fsp_bindings.h>
|
||||||
#include <asm/arch/fsp/fsp_configs.h>
|
#include <asm/arch/fsp/fsp_configs.h>
|
||||||
#include <asm/arch/fsp/fsp_s_upd.h>
|
#include <asm/arch/fsp/fsp_s_upd.h>
|
||||||
|
#include <dm/uclass-internal.h>
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
#include <asm/arch/fsp_bindings.h>
|
|
||||||
|
|
||||||
#define PCH_P2SB_E0 0xe0
|
#define PCH_P2SB_E0 0xe0
|
||||||
#define HIDE_BIT BIT(0)
|
#define HIDE_BIT BIT(0)
|
||||||
@@ -59,12 +61,6 @@ int fsps_update_config(struct udevice *dev, ulong rom_offset,
|
|||||||
return fsp_s_update_config_from_dtb(node, cfg);
|
return fsp_s_update_config_from_dtb(node, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void p2sb_set_hide_bit(pci_dev_t dev, int hide)
|
|
||||||
{
|
|
||||||
pci_x86_clrset_config(dev, PCH_P2SB_E0 + 1, HIDE_BIT,
|
|
||||||
hide ? HIDE_BIT : 0, PCI_SIZE_8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Configure package power limits */
|
/* Configure package power limits */
|
||||||
static int set_power_limits(struct udevice *dev)
|
static int set_power_limits(struct udevice *dev)
|
||||||
{
|
{
|
||||||
@@ -137,15 +133,15 @@ static int set_power_limits(struct udevice *dev)
|
|||||||
|
|
||||||
int p2sb_unhide(void)
|
int p2sb_unhide(void)
|
||||||
{
|
{
|
||||||
pci_dev_t dev = PCI_BDF(0, 0xd, 0);
|
struct udevice *dev;
|
||||||
ulong val;
|
int ret;
|
||||||
|
|
||||||
p2sb_set_hide_bit(dev, 0);
|
ret = uclass_find_first_device(UCLASS_P2SB, &dev);
|
||||||
|
if (ret)
|
||||||
pci_x86_read_config(dev, PCI_VENDOR_ID, &val, PCI_SIZE_16);
|
return log_msg_ret("p2sb", ret);
|
||||||
|
ret = p2sb_set_hide(dev, false);
|
||||||
if (val != PCI_VENDOR_ID_INTEL)
|
if (ret)
|
||||||
return log_msg_ret("p2sb unhide", -EIO);
|
return log_msg_ret("hide", ret);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
#include <asm/pci.h>
|
#include <asm/pci.h>
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
|
||||||
|
#define PCH_P2SB_E0 0xe0
|
||||||
|
#define HIDE_BIT BIT(0)
|
||||||
|
|
||||||
struct p2sb_platdata {
|
struct p2sb_platdata {
|
||||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
struct dtd_intel_p2sb dtplat;
|
struct dtd_intel_p2sb dtplat;
|
||||||
@@ -127,6 +130,29 @@ static int p2sb_probe(struct udevice *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void p2sb_set_hide_bit(struct udevice *dev, bool hide)
|
||||||
|
{
|
||||||
|
dm_pci_clrset_config8(dev, PCH_P2SB_E0 + 1, HIDE_BIT,
|
||||||
|
hide ? HIDE_BIT : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int intel_p2sb_set_hide(struct udevice *dev, bool hide)
|
||||||
|
{
|
||||||
|
u16 vendor;
|
||||||
|
|
||||||
|
if (!CONFIG_IS_ENABLED(PCI))
|
||||||
|
return -EPERM;
|
||||||
|
p2sb_set_hide_bit(dev, hide);
|
||||||
|
|
||||||
|
dm_pci_read_config16(dev, PCI_VENDOR_ID, &vendor);
|
||||||
|
if (hide && vendor != 0xffff)
|
||||||
|
return log_msg_ret("hide", -EEXIST);
|
||||||
|
else if (!hide && vendor != PCI_VENDOR_ID_INTEL)
|
||||||
|
return log_msg_ret("unhide", -ENOMEDIUM);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int p2sb_child_post_bind(struct udevice *dev)
|
static int p2sb_child_post_bind(struct udevice *dev)
|
||||||
{
|
{
|
||||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
@@ -143,6 +169,10 @@ static int p2sb_child_post_bind(struct udevice *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct p2sb_ops p2sb_ops = {
|
||||||
|
.set_hide = intel_p2sb_set_hide,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct udevice_id p2sb_ids[] = {
|
static const struct udevice_id p2sb_ids[] = {
|
||||||
{ .compatible = "intel,p2sb" },
|
{ .compatible = "intel,p2sb" },
|
||||||
{ }
|
{ }
|
||||||
@@ -153,6 +183,7 @@ U_BOOT_DRIVER(p2sb_drv) = {
|
|||||||
.id = UCLASS_P2SB,
|
.id = UCLASS_P2SB,
|
||||||
.of_match = p2sb_ids,
|
.of_match = p2sb_ids,
|
||||||
.probe = p2sb_probe,
|
.probe = p2sb_probe,
|
||||||
|
.ops = &p2sb_ops,
|
||||||
.ofdata_to_platdata = p2sb_ofdata_to_platdata,
|
.ofdata_to_platdata = p2sb_ofdata_to_platdata,
|
||||||
.platdata_auto_alloc_size = sizeof(struct p2sb_platdata),
|
.platdata_auto_alloc_size = sizeof(struct p2sb_platdata),
|
||||||
.per_child_platdata_auto_alloc_size =
|
.per_child_platdata_auto_alloc_size =
|
||||||
|
Reference in New Issue
Block a user