siemens/nc_fpga: Expand FPGA functionality
The siemens/mc_apl1 mainboard needs more functionality provided by
Siemens NC FPGA. The additional functionality contains backlight
brightness/PWM control and Dsave time for board reset.
Change-Id: I6b65b01f0d67afe598b7c005868f71b00dec56fd
Signed-off-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Reviewed-on: https://review.coreboot.org/20160
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
diff --git a/src/drivers/siemens/nc_fpga/nc_fpga.c b/src/drivers/siemens/nc_fpga/nc_fpga.c
index def456b..59e7d4b 100644
--- a/src/drivers/siemens/nc_fpga/nc_fpga.c
+++ b/src/drivers/siemens/nc_fpga/nc_fpga.c
@@ -119,6 +119,17 @@
init_temp_mon(bar0_ptr + NC_FANMON_CTRL_OFFSET);
if (cap & NC_CAP1_FAN_CTRL)
init_fan_ctrl(bar0_ptr + NC_FANMON_CTRL_OFFSET);
+ if (cap & NC_CAP1_DSAVE_NMI_DELAY) {
+ uint16_t *dsave_ptr = (uint16_t *)(bar0_ptr + NC_DSAVE_OFFSET);
+ FPGA_SET_PARAM(NvramVirtTimeDsaveReset, *dsave_ptr);
+ }
+ if (cap & NC_CAP1_BL_BRIGHTNESS_CTRL) {
+ uint8_t *bl_bn_ptr =
+ (uint8_t *)(bar0_ptr + NC_BL_BRIGHTNESS_OFFSET);
+ uint8_t *bl_pwm_ptr = (uint8_t *)(bar0_ptr + NC_BL_PWM_OFFSET);
+ FPGA_SET_PARAM(BL_Brightness, *bl_bn_ptr);
+ FPGA_SET_PARAM(PF_PwmFreq, *bl_pwm_ptr);
+ }
}
static struct device_operations nc_fpga_ops = {
@@ -130,10 +141,10 @@
.ops_pci = 0,
};
-static const unsigned short nc_fpga_device_ids[] = { 0x4091, 0 };
+static const unsigned short nc_fpga_device_ids[] = { 0x4080, 0x4091, 0 };
static const struct pci_driver nc_fpga_driver __pci_driver = {
.ops = &nc_fpga_ops,
- .vendor = 0x110A,
+ .vendor = PCI_VENDOR_ID_SIEMENS,
.devices = nc_fpga_device_ids,
};
diff --git a/src/drivers/siemens/nc_fpga/nc_fpga.h b/src/drivers/siemens/nc_fpga/nc_fpga.h
index 886f3dd..a5a7ab8 100644
--- a/src/drivers/siemens/nc_fpga/nc_fpga.h
+++ b/src/drivers/siemens/nc_fpga/nc_fpga.h
@@ -16,12 +16,17 @@
#ifndef _SIEMENS_NC_FPGA_H_
#define _SIEMENS_NC_FPGA_H_
-#define NC_MAGIC_OFFSET 0x020
-#define NC_FPGA_MAGIC 0x4E433746
-#define NC_CAP1_OFFSET 0x080
-#define NC_CAP1_FAN_CTRL 0x080
-#define NC_CAP1_TEMP_MON 0x100
-#define NC_FANMON_CTRL_OFFSET 0x400
+#define NC_MAGIC_OFFSET 0x020
+#define NC_FPGA_MAGIC 0x4E433746
+#define NC_CAP1_OFFSET 0x080
+#define NC_CAP1_DSAVE_NMI_DELAY 0x008
+#define NC_CAP1_BL_BRIGHTNESS_CTRL 0x010
+#define NC_CAP1_FAN_CTRL 0x080
+#define NC_CAP1_TEMP_MON 0x100
+#define NC_DSAVE_OFFSET 0x58
+#define NC_BL_BRIGHTNESS_OFFSET 0x88
+#define NC_BL_PWM_OFFSET 0x8C
+#define NC_FANMON_CTRL_OFFSET 0x400
#define MAX_NUM_SENSORS 4