Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32037
Change subject: sb/intel/bd82x6x: Use SOUTHBRIDGE_INTEL_COMMON_PMCLIB
......................................................................
sb/intel/bd82x6x: Use SOUTHBRIDGE_INTEL_COMMON_PMCLIB
Use common code to detect ACPI S3.
Untested.
Change-Id: I283a841575430f2f179997db8d2f08fa3978a0bb
Signed-off-by: Patrick Rudolph <patrick.rudolph(a)9elements.com>
---
M src/northbridge/intel/sandybridge/romstage.c
M src/southbridge/intel/bd82x6x/Kconfig
M src/southbridge/intel/bd82x6x/Makefile.inc
D src/southbridge/intel/bd82x6x/early_pch_common.c
M src/southbridge/intel/bd82x6x/pch.h
5 files changed, 3 insertions(+), 55 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/32037/1
diff --git a/src/northbridge/intel/sandybridge/romstage.c b/src/northbridge/intel/sandybridge/romstage.c
index 6112c76..8ddc156 100644
--- a/src/northbridge/intel/sandybridge/romstage.c
+++ b/src/northbridge/intel/sandybridge/romstage.c
@@ -28,6 +28,7 @@
#include <device/device.h>
#include <northbridge/intel/sandybridge/chip.h>
#include <southbridge/intel/bd82x6x/pch.h>
+#include <southbridge/intel/common/pmclib.h>
static void early_pch_reset_pmcon(void)
{
diff --git a/src/southbridge/intel/bd82x6x/Kconfig b/src/southbridge/intel/bd82x6x/Kconfig
index 1396a63..dae3c32 100644
--- a/src/southbridge/intel/bd82x6x/Kconfig
+++ b/src/southbridge/intel/bd82x6x/Kconfig
@@ -29,6 +29,7 @@
select SOUTHBRIDGE_INTEL_COMMON_RCBA_PIRQ
select SOUTHBRIDGE_INTEL_COMMON_SMBUS
select SOUTHBRIDGE_INTEL_COMMON_SPI
+ select SOUTHBRIDGE_INTEL_COMMON_PMCLIB
select IOAPIC
select HAVE_USBDEBUG_OPTIONS
select HAVE_SMI_HANDLER
diff --git a/src/southbridge/intel/bd82x6x/Makefile.inc b/src/southbridge/intel/bd82x6x/Makefile.inc
index 24d7e2d..7ce3da7 100644
--- a/src/southbridge/intel/bd82x6x/Makefile.inc
+++ b/src/southbridge/intel/bd82x6x/Makefile.inc
@@ -38,7 +38,7 @@
smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c me.c me_8.x.c pch.c
romstage-y += early_smbus.c me_status.c
-romstage-y += early_spi.c early_pch_common.c
+romstage-y += early_spi.c
romstage-y += early_rcba.c
ifeq ($(CONFIG_USE_NATIVE_RAMINIT),y)
@@ -47,6 +47,4 @@
romstage-y += early_me_mrc.c early_usb_mrc.c
endif
-ramstage-y += early_pch_common.c
-
endif
diff --git a/src/southbridge/intel/bd82x6x/early_pch_common.c b/src/southbridge/intel/bd82x6x/early_pch_common.c
deleted file mode 100644
index 2e9ad7f..0000000
--- a/src/southbridge/intel/bd82x6x/early_pch_common.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2008-2009 coresystems GmbH
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; version 2 of
- * the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <arch/io.h>
-#include <device/pci_def.h>
-#include <device/pci_ops.h>
-#include "pch.h"
-#include <arch/acpi.h>
-#include <console/console.h>
-
-#if ENV_ROMSTAGE
-int southbridge_detect_s3_resume(void)
-{
- u32 pm1_cnt;
- u16 pm1_sts;
-
- /* Check PM1_STS[15] to see if we are waking from Sx */
- pm1_sts = inw(DEFAULT_PMBASE + PM1_STS);
-
- /* Read PM1_CNT[12:10] to determine which Sx state */
- pm1_cnt = inl(DEFAULT_PMBASE + PM1_CNT);
-
- if ((pm1_sts & WAK_STS) && ((pm1_cnt >> 10) & 7) == 5) {
- if (acpi_s3_resume_allowed()) {
- printk(BIOS_DEBUG, "Resume from S3 detected.\n");
- /* Clear SLP_TYPE. This will break stage2 but
- * we care for that when we get there.
- */
- outl(pm1_cnt & ~(7 << 10), DEFAULT_PMBASE + PM1_CNT);
- return 1;
- } else {
- printk(BIOS_DEBUG, "Resume from S3 detected, but disabled.\n");
- }
- }
-
- return 0;
-}
-#endif
diff --git a/src/southbridge/intel/bd82x6x/pch.h b/src/southbridge/intel/bd82x6x/pch.h
index 0097e15..21b6031 100644
--- a/src/southbridge/intel/bd82x6x/pch.h
+++ b/src/southbridge/intel/bd82x6x/pch.h
@@ -76,7 +76,6 @@
void southbridge_rcba_config(void);
void mainboard_rcba_config(void);
void early_pch_init_native(void);
-int southbridge_detect_s3_resume(void);
void early_pch_init(void);
struct southbridge_usb_port
--
To view, visit https://review.coreboot.org/c/coreboot/+/32037
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I283a841575430f2f179997db8d2f08fa3978a0bb
Gerrit-Change-Number: 32037
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-MessageType: newchange
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32036
Change subject: sb/intel/common: Add common detect_s3_resume
......................................................................
sb/intel/common: Add common detect_s3_resume
Add a common detect_s3_resume function.
Will be used by other southbridge code.
TODO: Merge with soc/intel/common/*/pmclib
Change-Id: I88023af522afac8164f068b0fbe0eac601aef702
Signed-off-by: Patrick Rudolph <patrick.rudolph(a)9elements.com>
---
M src/southbridge/intel/common/Kconfig
M src/southbridge/intel/common/Makefile.inc
A src/southbridge/intel/common/pmclib.c
A src/southbridge/intel/common/pmclib.h
4 files changed, 83 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/32036/1
diff --git a/src/southbridge/intel/common/Kconfig b/src/southbridge/intel/common/Kconfig
index 6a96277..308c4f4 100644
--- a/src/southbridge/intel/common/Kconfig
+++ b/src/southbridge/intel/common/Kconfig
@@ -6,6 +6,9 @@
bool
select HAVE_CF9_RESET
+config SOUTHBRIDGE_INTEL_COMMON_PMCLIB
+ def_bool n
+
config SOUTHBRIDGE_INTEL_COMMON_GPIO
def_bool n
diff --git a/src/southbridge/intel/common/Makefile.inc b/src/southbridge/intel/common/Makefile.inc
index 3ad7924..ac339a2 100644
--- a/src/southbridge/intel/common/Makefile.inc
+++ b/src/southbridge/intel/common/Makefile.inc
@@ -25,6 +25,8 @@
romstage-$(CONFIG_SOUTHBRIDGE_INTEL_COMMON_SMBUS) += smbus.c
ramstage-$(CONFIG_SOUTHBRIDGE_INTEL_COMMON_SMBUS) += smbus.c
+romstage-$(CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMCLIB) += pmclib.c
+
ifeq ($(CONFIG_SOUTHBRIDGE_INTEL_COMMON),y)
romstage-y += pmbase.c
diff --git a/src/southbridge/intel/common/pmclib.c b/src/southbridge/intel/common/pmclib.c
new file mode 100644
index 0000000..198562b
--- /dev/null
+++ b/src/southbridge/intel/common/pmclib.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008-2009 coresystems GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdint.h>
+#include <arch/acpi.h>
+#include <console/console.h>
+
+#include "pmclib.h"
+#include "pmbase.h"
+#include "pmutil.h"
+
+int southbridge_detect_s3_resume(void)
+{
+ u32 pm1_cnt;
+ u16 pm1_sts;
+ int is_s3 = 0;
+
+ /* Check PM1_STS[15] to see if we are waking from Sx */
+ pm1_sts = read_pmbase16(PM1_STS);
+ if (pm1_sts & WAK_STS) {
+ /* Read PM1_CNT[12:10] to determine which Sx state */
+ pm1_cnt = read_pmbase32(PM1_CNT);
+ if (((pm1_cnt >> 10) & 7) == SLP_TYP_S3) {
+ /* Clear SLP_TYPE. */
+ write_pmbase32(PM1_CNT, pm1_cnt & ~(7 << 10));
+ is_s3 = 1;
+ }
+ }
+ if (is_s3) {
+ if (!acpi_s3_resume_allowed()) {
+ printk(BIOS_DEBUG, "SB: Resume from S3 detected, but disabled.\n");
+ return 0;
+ }
+
+ printk(BIOS_DEBUG, "SB: Resume from S3 detected.\n");
+ }
+
+ return is_s3;
+}
diff --git a/src/southbridge/intel/common/pmclib.h b/src/southbridge/intel/common/pmclib.h
new file mode 100644
index 0000000..7de5f97
--- /dev/null
+++ b/src/southbridge/intel/common/pmclib.h
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008-2009 coresystems GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef INTEL_COMMON_PMCLIB_H
+#define INTEL_COMMON_PMCLIB_H
+
+/*
+ * Returns 1 if platform was in ACPI S3 power state and CONFIG(ACPI_RESUME)
+ * is enabled else returns 0.
+ */
+int southbridge_detect_s3_resume(void);
+
+#endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/32036
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I88023af522afac8164f068b0fbe0eac601aef702
Gerrit-Change-Number: 32036
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange
Frans Hendriks has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31710
Change subject: drivers/spi: Move M25Pxx commands to spi_winbond.h
......................................................................
drivers/spi: Move M25Pxx commands to spi_winbond.h
Move Wnbond M25PXX command values to spi_winbond.h
Now the commands value can be used for programming SPI
contoller of Intel Braswell, by using including file.
Update winbond.c file with coreboot header.
BUG=N/A
TEST=Facebook FBG-1701 with flashrom
Change-Id: I9c17c4ed7004209bd3c619d47a7474b0b7e17495
Signed-off-by: Frans Hendriks <fhendriks(a)eltan.com>
---
A src/drivers/spi/spi_winbond.h
M src/drivers/spi/winbond.c
2 files changed, 49 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/31710/1
diff --git a/src/drivers/spi/spi_winbond.h b/src/drivers/spi/spi_winbond.h
new file mode 100644
index 0000000..e21571c
--- /dev/null
+++ b/src/drivers/spi/spi_winbond.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2008, Network Appliance Inc.
+ * Author: Jason McMullan <mcmullan <at> netapp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/* Winbond specific function */
+/* M25Pxx-specific commands */
+#define CMD_W25_WREN 0x06 /* Write Enable */
+#define CMD_W25_WRDI 0x04 /* Write Disable */
+#define CMD_W25_RDSR 0x05 /* Read Status Register */
+#define CMD_W25_WRSR 0x01 /* Write Status Register */
+#define CMD_W25_RDSR2 0x35 /* Read Status2 Register */
+#define CMD_W25_WRSR2 0x31 /* Write Status2 Register */
+#define CMD_W25_READ 0x03 /* Read Data Bytes */
+#define CMD_W25_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */
+#define CMD_W25_PP 0x02 /* Page Program */
+#define CMD_W25_SE 0x20 /* Sector (4K) Erase */
+#define CMD_W25_RDID 0x9f /* Read ID */
+#define CMD_W25_BE 0xd8 /* Block (64K) Erase */
+#define CMD_W25_CE 0xc7 /* Chip Erase */
+#define CMD_W25_DP 0xb9 /* Deep Power-down */
+#define CMD_W25_RES 0xab /* Release from DP and Read Signature */
+#define CMD_VOLATILE_SREG_WREN 0x50 /* Write Enable for Volatile SREG */
+
+/* tw: Maximum time to write a flash cell in milliseconds */
+#define WINBOND_FLASH_TIMEOUT 30
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 8bf8fcd..7276ec1 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -1,7 +1,16 @@
/*
* Copyright 2008, Network Appliance Inc.
- * Author: Jason McMullan <mcmullan <at> netapp.com>
- * Licensed under the GPL-2 or later.
+ * Jason McMullan <mcmullan(a)netapp.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*/
#include <console/console.h>
@@ -14,26 +23,7 @@
#include <lib.h>
#include "spi_flash_internal.h"
-
-/* M25Pxx-specific commands */
-#define CMD_W25_WREN 0x06 /* Write Enable */
-#define CMD_W25_WRDI 0x04 /* Write Disable */
-#define CMD_W25_RDSR 0x05 /* Read Status Register */
-#define CMD_W25_WRSR 0x01 /* Write Status Register */
-#define CMD_W25_RDSR2 0x35 /* Read Status2 Register */
-#define CMD_W25_WRSR2 0x31 /* Write Status2 Register */
-#define CMD_W25_READ 0x03 /* Read Data Bytes */
-#define CMD_W25_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */
-#define CMD_W25_PP 0x02 /* Page Program */
-#define CMD_W25_SE 0x20 /* Sector (4K) Erase */
-#define CMD_W25_BE 0xd8 /* Block (64K) Erase */
-#define CMD_W25_CE 0xc7 /* Chip Erase */
-#define CMD_W25_DP 0xb9 /* Deep Power-down */
-#define CMD_W25_RES 0xab /* Release from DP, and Read Signature */
-#define CMD_VOLATILE_SREG_WREN 0x50 /* Write Enable for Volatile SREG */
-
-/* tw: Maximum time to write a flash cell in milliseconds */
-#define WINBOND_FLASH_TIMEOUT 30
+#include "spi_winbond.h"
struct winbond_spi_flash_params {
uint16_t id;
--
To view, visit https://review.coreboot.org/c/coreboot/+/31710
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9c17c4ed7004209bd3c619d47a7474b0b7e17495
Gerrit-Change-Number: 31710
Gerrit-PatchSet: 1
Gerrit-Owner: Frans Hendriks <fhendriks(a)eltan.com>
Gerrit-MessageType: newchange