summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/siemens/nc_fpga/Kconfig4
-rw-r--r--src/drivers/siemens/nc_fpga/nc_fpga.c22
-rw-r--r--src/drivers/siemens/nc_fpga/nc_fpga.h2
3 files changed, 28 insertions, 0 deletions
diff --git a/src/drivers/siemens/nc_fpga/Kconfig b/src/drivers/siemens/nc_fpga/Kconfig
index 832446fcc2..1cd797772f 100644
--- a/src/drivers/siemens/nc_fpga/Kconfig
+++ b/src/drivers/siemens/nc_fpga/Kconfig
@@ -1,3 +1,7 @@
config DRIVER_SIEMENS_NC_FPGA
bool
default n
+
+config NC_FPGA_NOTIFY_CB_READY
+ bool
+ default n
diff --git a/src/drivers/siemens/nc_fpga/nc_fpga.c b/src/drivers/siemens/nc_fpga/nc_fpga.c
index 28fc6e2edf..643970343d 100644
--- a/src/drivers/siemens/nc_fpga/nc_fpga.c
+++ b/src/drivers/siemens/nc_fpga/nc_fpga.c
@@ -22,8 +22,11 @@
#include <string.h>
#include <delay.h>
#include <hwilib.h>
+#include <bootstate.h>
#include "nc_fpga.h"
+static void *nc_fpga_bar0;
+
#define FPGA_SET_PARAM(src, dst) \
{ \
uint32_t var; \
@@ -111,6 +114,9 @@ static void nc_fpga_init(struct device *dev)
/* Ensure this is really a NC FPGA by checking magic register. */
if (read32(bar0_ptr + NC_MAGIC_OFFSET) != NC_FPGA_MAGIC)
return;
+ /* Save BAR0 address so that it can be used on all NC_FPGA devices to
+ set the FW_DONE bit before jumping to payload. */
+ nc_fpga_bar0 = bar0_ptr;
/* Open hwinfo block. */
if (hwilib_find_blocks("hwinfo.hex") != CB_SUCCESS)
return;
@@ -134,6 +140,22 @@ static void nc_fpga_init(struct device *dev)
}
}
+#if IS_ENABLED(CONFIG_NC_FPGA_NOTIFY_CB_READY)
+/* Set FW_DONE bit in FPGA before jumping to payload. */
+static void set_fw_done(void *unused)
+{
+ uint32_t reg;
+
+ if (nc_fpga_bar0) {
+ reg = read32(nc_fpga_bar0 + NC_DIAG_CTRL_OFFSET);
+ reg |= NC_DIAG_FW_DONE;
+ write32(nc_fpga_bar0 + NC_DIAG_CTRL_OFFSET, reg);
+ }
+}
+
+BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, set_fw_done, NULL);
+#endif
+
static struct device_operations nc_fpga_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
diff --git a/src/drivers/siemens/nc_fpga/nc_fpga.h b/src/drivers/siemens/nc_fpga/nc_fpga.h
index 7bf087b69a..8a98627889 100644
--- a/src/drivers/siemens/nc_fpga/nc_fpga.h
+++ b/src/drivers/siemens/nc_fpga/nc_fpga.h
@@ -26,6 +26,8 @@
#define NC_CAP1_FAN_CTRL 0x080
#define NC_CAP1_TEMP_MON 0x100
#define NC_DSAVE_OFFSET 0x58
+#define NC_DIAG_CTRL_OFFSET 0x60
+#define NC_DIAG_FW_DONE 0x10000
#define NC_BL_BRIGHTNESS_OFFSET 0x88
#define NC_BL_PWM_OFFSET 0x8C
#define NC_FANMON_CTRL_OFFSET 0x400