summaryrefslogtreecommitdiff
path: root/src/superio
diff options
context:
space:
mode:
Diffstat (limited to 'src/superio')
-rw-r--r--src/superio/winbond/w83627hf/Makefile.inc2
-rw-r--r--src/superio/winbond/w83627hf/early_init.c37
-rw-r--r--src/superio/winbond/w83627hf/early_serial.c12
-rw-r--r--src/superio/winbond/w83627hf/w83627hf.h14
4 files changed, 46 insertions, 19 deletions
diff --git a/src/superio/winbond/w83627hf/Makefile.inc b/src/superio/winbond/w83627hf/Makefile.inc
index be5ec48885..45c8c9c7b2 100644
--- a/src/superio/winbond/w83627hf/Makefile.inc
+++ b/src/superio/winbond/w83627hf/Makefile.inc
@@ -20,5 +20,5 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
+romstage-$(CONFIG_SUPERIO_WINBOND_W83627HF) += early_init.c
ramstage-$(CONFIG_SUPERIO_WINBOND_W83627HF) += superio.c
-
diff --git a/src/superio/winbond/w83627hf/early_init.c b/src/superio/winbond/w83627hf/early_init.c
index 66b40980a2..db616aee38 100644
--- a/src/superio/winbond/w83627hf/early_init.c
+++ b/src/superio/winbond/w83627hf/early_init.c
@@ -2,8 +2,9 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2000 AG Electronics Ltd.
- * Copyright 2003-2004 Linux Networx
- * Copyright 2004 Tyan
+ * Copyright (C) 2003-2004 Linux Networx
+ * Copyright (C) 2004 Tyan
+ * Copyright (C) 2010 Win Enterprises (anishp@win-ent.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,18 +22,34 @@
*/
#include <arch/io.h>
+#include <device/pnp.h>
#include "w83627hf.h"
-void w83627hf_disable_dev(device_t dev)
+static void pnp_enter_ext_func_mode(device_t dev)
{
- pnp_set_logical_device(dev);
- pnp_set_enable(dev, 0);
+ u16 port = dev >> 8;
+ outb(0x87, port);
+ outb(0x87, port);
}
-void w83627hf_enable_dev(device_t dev, u16 iobase)
+static void pnp_exit_ext_func_mode(device_t dev)
{
- pnp_set_logical_device(dev);
- pnp_set_enable(dev, 0);
- pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
- pnp_set_enable(dev, 1);
+ u16 port = dev >> 8;
+ outb(0xaa, port);
+}
+
+/*
+ * We duplicate this function, for non-ROMCC boards, from early_serial.c to
+ * work around a limitation of ROMCC where we can no make early_serial.c into
+ * link-time symbols and #include early_serial.c.
+ */
+void w83627hf_set_clksel_48(device_t dev)
+{
+ u8 reg8;
+
+ pnp_enter_ext_func_mode(dev);
+ reg8 = pnp_read_config(dev, 0x24);
+ reg8 |= (1 << 6); /* Set CLKSEL (clock input on pin 1) to 48MHz. */
+ pnp_write_config(dev, 0x24, reg8);
+ pnp_exit_ext_func_mode(dev);
}
diff --git a/src/superio/winbond/w83627hf/early_serial.c b/src/superio/winbond/w83627hf/early_serial.c
index db2827bfdb..bc251a67e3 100644
--- a/src/superio/winbond/w83627hf/early_serial.c
+++ b/src/superio/winbond/w83627hf/early_serial.c
@@ -37,6 +37,18 @@ static void pnp_exit_ext_func_mode(device_t dev)
outb(0xaa, port);
}
+/*
+ * FIXME: The following ROMCC boards are blocking the removal this superio's
+ * model specific w83627hf_enable_serial() symbol.
+ *
+ * mainboard/supermicro/x6dai_g
+ * mainboard/supermicro/x6dhe_g
+ * mainboard/supermicro/x6dhr_ig
+ * mainboard/supermicro/x6dhr_ig2
+ *
+ * XXX: ROMCC - everything is inlined, no forwarding function prototypes
+ * declarations are accepted.
+ */
void w83627hf_enable_serial(device_t dev, u16 iobase)
{
pnp_enter_ext_func_mode(dev);
diff --git a/src/superio/winbond/w83627hf/w83627hf.h b/src/superio/winbond/w83627hf/w83627hf.h
index 468cb55b43..bf7186ea4a 100644
--- a/src/superio/winbond/w83627hf/w83627hf.h
+++ b/src/superio/winbond/w83627hf/w83627hf.h
@@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef SUPERIO_WINBOND_W83627HF_W83627HF_H
-#define SUPERIO_WINBOND_W83627HF_W83627HF_H
+#ifndef SUPERIO_WINBOND_W83627HF_H
+#define SUPERIO_WINBOND_W83627HF_H
#define W83627HF_FDC 0 /* Floppy */
#define W83627HF_PP 1 /* Parallel port */
@@ -113,11 +113,9 @@
#define W83627HF_XSCNF 0x15
#define W83627HF_XWBCNF 0x16
-#if defined(__PRE_RAM__)
-void w83627hf_disable_dev(device_t dev);
-void w83627hf_enable_dev(device_t dev, u16 iobase);
-void w83627hf_enable_serial(device_t dev, u16 iobase);
+#include <arch/io.h>
+
void w83627hf_set_clksel_48(device_t dev);
-#endif
+void w83627hf_enable_serial(device_t dev, u16 iobase);
-#endif
+#endif /* SUPERIO_WINBOND_W83627HF_H */