summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan A. Kollasch <jakllsch@kollasch.net>2015-06-14 13:13:52 -0500
committerJonathan A. Kollasch <jakllsch@kollasch.net>2015-06-17 16:01:48 +0200
commitd9628ece50bdbee32b2db9f63bc8cbba10e5ff1a (patch)
tree6f662bd06cccf1624404641b473386f4723ed131 /src
parent7558dbac3179d51c78c092c12fe23a8ff8549496 (diff)
downloadcoreboot-d9628ece50bdbee32b2db9f63bc8cbba10e5ff1a.tar.xz
winent/mb6047: initialize hardware monitor CPUTIN configuration
Change-Id: Ic36727104e5c2f620f9b2b7b340de8548b467397 Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net> Reviewed-on: http://review.coreboot.org/10547 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/winent/mb6047/mainboard.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/mainboard/winent/mb6047/mainboard.c b/src/mainboard/winent/mb6047/mainboard.c
index 6ebe04c869..d5ec572429 100644
--- a/src/mainboard/winent/mb6047/mainboard.c
+++ b/src/mainboard/winent/mb6047/mainboard.c
@@ -1,7 +1,54 @@
+#include <arch/io.h>
+#include <console/console.h>
#include <device/device.h>
+#include <device/pnp_def.h>
+#include <stdlib.h>
+#include <superio/winbond/w83627thg/w83627thg.h>
+
+static void hwm_write(u16 base, u8 bank, u8 reg, u8 value)
+{
+ outb(0x4e, base + 0x05);
+ outb(bank, base + 0x06);
+ outb(reg, base + 0x05);
+ outb(value, base + 0x06);
+}
+
+static void mb6047_hwm_init(void)
+{
+ device_t dev;
+ struct resource *res;
+ size_t i;
+
+ static const struct { u8 bnk; u8 idx; u8 dat; } hwmtab[] = {
+ { 0x00, 0x5d, 0x05 }, /* CPUTIN diode */
+ { 0x04, 0x55, 0x32 }, /* CPUTIN offset */
+ { 0x00, 0x4e, 0x00 }, /* reset bank */
+ };
+
+ dev = dev_find_slot_pnp(0x2e, W83627THG_HWM);
+ if (dev == NULL)
+ return;
+
+ res = find_resource(dev, PNP_IDX_IO0);
+ if (res == NULL)
+ return;
+
+ printk(BIOS_INFO, "setting up hardware monitor at 0x%04x\n", (unsigned int)res->base);
+
+ /* Init hardware monitor. */
+ for (i = 0; i < ARRAY_SIZE(hwmtab); i++) {
+ hwm_write(res->base, hwmtab[i].bnk, hwmtab[i].idx, hwmtab[i].dat);
+ }
+}
+
+static void mb6047_mainboard_init(device_t dev)
+{
+ mb6047_hwm_init();
+}
static void mainboard_enable(device_t dev)
{
+ dev->ops->init = mb6047_mainboard_init;
}
struct chip_operations mainboard_ops = {