From c4ff1de8bf65718a7fcb1aa3a77f7024140fecef Mon Sep 17 00:00:00 2001 From: Mario Scheithauer Date: Mon, 12 Jun 2017 10:02:10 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/20160 Tested-by: build bot (Jenkins) Reviewed-by: Werner Zeh Reviewed-by: Paul Menzel --- src/drivers/siemens/nc_fpga/nc_fpga.c | 15 +++++++++++++-- src/drivers/siemens/nc_fpga/nc_fpga.h | 17 +++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/drivers/siemens/nc_fpga/nc_fpga.c b/src/drivers/siemens/nc_fpga/nc_fpga.c index def456bbb6..59e7d4bd2f 100644 --- a/src/drivers/siemens/nc_fpga/nc_fpga.c +++ b/src/drivers/siemens/nc_fpga/nc_fpga.c @@ -119,6 +119,17 @@ static void nc_fpga_init(struct device *dev) 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 @@ static struct device_operations nc_fpga_ops = { .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 886f3dda05..a5a7ab8faf 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