summaryrefslogtreecommitdiff
path: root/src/soc/intel/quark/include
diff options
context:
space:
mode:
authorLee Leahy <leroy.p.leahy@intel.com>2016-04-30 08:48:52 -0700
committerLeroy P Leahy <leroy.p.leahy@intel.com>2016-05-05 17:53:54 +0200
commit63e3dff02f5b66b32b32fd1497f820532af25a07 (patch)
treeaadcc2d5bc2f05c33418aa80e9e5b3a29e8f7d4f /src/soc/intel/quark/include
parent4dd34eee092276e47a9be41ff9a51dfcde38d759 (diff)
downloadcoreboot-63e3dff02f5b66b32b32fd1497f820532af25a07.tar.xz
soc/intel/quark: Add temperature sensor support
Migrate the temperature sensor support from QuarkFspPkg into coreboot. TEST=Build and run on Galileo Gen2 Change-Id: I6dc68c735375c9d1777693264674521f67397556 Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com> Reviewed-on: https://review.coreboot.org/14565 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/soc/intel/quark/include')
-rw-r--r--src/soc/intel/quark/include/soc/reg_access.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/soc/intel/quark/include/soc/reg_access.h b/src/soc/intel/quark/include/soc/reg_access.h
index 934c75d0e5..ddca6682cd 100644
--- a/src/soc/intel/quark/include/soc/reg_access.h
+++ b/src/soc/intel/quark/include/soc/reg_access.h
@@ -18,10 +18,13 @@
#include <fsp/util.h>
#include <reg_script.h>
+#include <soc/IntelQNCConfig.h>
#include <soc/QuarkNcSocId.h>
enum {
USB_PHY_REGS = 1,
+ SOC_UNIT_REGS,
+ RMU_TEMP_REGS,
};
enum {
@@ -32,6 +35,50 @@ enum {
#define SOC_ACCESS(cmd_, reg_, size_, mask_, value_, timeout_, reg_set_) \
_REG_SCRIPT_ENCODE_RAW(REG_SCRIPT_COMMAND_##cmd_, SOC_TYPE, \
size_, reg_, mask_, value_, timeout_, reg_set_)
+
+/* RMU temperature register access macros */
+#define REG_RMU_TEMP_ACCESS(cmd_, reg_, mask_, value_, timeout_) \
+ SOC_ACCESS(cmd_, reg_, REG_SCRIPT_SIZE_32, mask_, value_, timeout_, \
+ RMU_TEMP_REGS)
+#define REG_RMU_TEMP_READ(reg_) \
+ REG_RMU_TEMP_ACCESS(READ, reg_, 0, 0, 0)
+#define REG_RMU_TEMP_WRITE(reg_, value_) \
+ REG_RMU_TEMP_ACCESS(WRITE, reg_, 0, value_, 0)
+#define REG_RMU_TEMP_AND(reg_, value_) \
+ REG_RMU_TEMP_RMW(reg_, value_, 0)
+#define REG_RMU_TEMP_RMW(reg_, mask_, value_) \
+ REG_RMU_TEMP_ACCESS(RMW, reg_, mask_, value_, 0)
+#define REG_RMU_TEMP_RXW(reg_, mask_, value_) \
+ REG_RMU_TEMP_ACCESS(RXW, reg_, mask_, value_, 0)
+#define REG_RMU_TEMP_OR(reg_, value_) \
+ REG_RMU_TEMP_RMW(reg_, 0xffffffff, value_)
+#define REG_RMU_TEMP_POLL(reg_, mask_, value_, timeout_) \
+ REG_RMU_TEMP_ACCESS(POLL, reg_, mask_, value_, timeout_)
+#define REG_RMU_TEMP_XOR(reg_, value_) \
+ REG_RMU_TEMP_RXW(reg_, 0xffffffff, value_)
+
+/* Temperature sensor access macros */
+#define REG_SOC_UNIT_ACCESS(cmd_, reg_, mask_, value_, timeout_) \
+ SOC_ACCESS(cmd_, reg_, REG_SCRIPT_SIZE_32, mask_, value_, timeout_, \
+ SOC_UNIT_REGS)
+#define REG_SOC_UNIT_READ(reg_) \
+ REG_SOC_UNIT_ACCESS(READ, reg_, 0, 0, 0)
+#define REG_SOC_UNIT_WRITE(reg_, value_) \
+ REG_SOC_UNIT_ACCESS(WRITE, reg_, 0, value_, 0)
+#define REG_SOC_UNIT_AND(reg_, value_) \
+ REG_SOC_UNIT_RMW(reg_, value_, 0)
+#define REG_SOC_UNIT_RMW(reg_, mask_, value_) \
+ REG_SOC_UNIT_ACCESS(RMW, reg_, mask_, value_, 0)
+#define REG_SOC_UNIT_RXW(reg_, mask_, value_) \
+ REG_SOC_UNIT_ACCESS(RXW, reg_, mask_, value_, 0)
+#define REG_SOC_UNIT_OR(reg_, value_) \
+ REG_SOC_UNIT_RMW(reg_, 0xffffffff, value_)
+#define REG_SOC_UNIT_POLL(reg_, mask_, value_, timeout_) \
+ REG_SOC_UNIT_ACCESS(POLL, reg_, mask_, value_, timeout_)
+#define REG_SOC_UNIT_XOR(reg_, value_) \
+ REG_SOC_UNIT_RXW(reg_, 0xffffffff, value_)
+
+/* USB register access macros */
#define REG_USB_ACCESS(cmd_, reg_, mask_, value_, timeout_) \
SOC_ACCESS(cmd_, reg_, REG_SCRIPT_SIZE_32, mask_, value_, timeout_, \
USB_PHY_REGS)
@@ -56,5 +103,6 @@ void mcr_write(uint8_t opcode, uint8_t port, uint32_t reg_address);
uint32_t mdr_read(void);
void mdr_write(uint32_t value);
void mea_write(uint32_t reg_address);
+uint32_t reg_rmu_temp_read(uint32_t reg_address);
#endif /* _QUARK_REG_ACCESS_H_ */