[coreboot-gerrit] New patch to review for coreboot: 5e396b2 Super I/O: Add support for Fintek F81216H
Bruce Griffith (Bruce.Griffith@se-eng.com)
gerrit at coreboot.org
Tue Jun 10 13:26:20 CEST 2014
Bruce Griffith (Bruce.Griffith at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5966
-gerrit
commit 5e396b2e42a2e6484022cac308cf8a264a2000be
Author: Bruce Griffith <Bruce.Griffith at se-eng.com>
Date: Tue Jun 10 01:50:20 2014 -0600
Super I/O: Add support for Fintek F81216H
A new Fintek Super I/O chip will be used on an upcoming AMD development
board. Use the Fintek common directories to enable the serial ports
on the new device.
Change-Id: Ie6b86db6a0f654265c06deed89d2e20bae266e80
Signed-off-by: Bruce Griffith <Bruce.Griffith at se-eng.com>
---
src/superio/fintek/Kconfig | 3 +
src/superio/fintek/Makefile.inc | 1 +
src/superio/fintek/f81216h/Makefile.inc | 21 +++++++
src/superio/fintek/f81216h/f81216h.h | 34 +++++++++++
src/superio/fintek/f81216h/superio.c | 102 ++++++++++++++++++++++++++++++++
5 files changed, 161 insertions(+)
diff --git a/src/superio/fintek/Kconfig b/src/superio/fintek/Kconfig
index f577898..cd72c0a 100644
--- a/src/superio/fintek/Kconfig
+++ b/src/superio/fintek/Kconfig
@@ -50,3 +50,6 @@ config SUPERIO_FINTEK_F71889
config SUPERIO_FINTEK_F81865F
bool
select SUPERIO_FINTEK_COMMON_ROMSTAGE
+config SUPERIO_FINTEK_F81216H
+ bool
+ select SUPERIO_FINTEK_COMMON_ROMSTAGE
diff --git a/src/superio/fintek/Makefile.inc b/src/superio/fintek/Makefile.inc
index 1b11336..8d64f64 100644
--- a/src/superio/fintek/Makefile.inc
+++ b/src/superio/fintek/Makefile.inc
@@ -27,3 +27,4 @@ subdirs-y += f71869ad
subdirs-y += f71872
subdirs-y += f71889
subdirs-y += f81865f
+subdirs-y += f81216h
diff --git a/src/superio/fintek/f81216h/Makefile.inc b/src/superio/fintek/f81216h/Makefile.inc
new file mode 100644
index 0000000..73bc84f
--- /dev/null
+++ b/src/superio/fintek/f81216h/Makefile.inc
@@ -0,0 +1,21 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2011 Advanced Micro Devices, Inc.
+##
+## 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
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##
+
+ramstage-$(CONFIG_SUPERIO_FINTEK_F81216H) += superio.c
diff --git a/src/superio/fintek/f81216h/f81216h.h b/src/superio/fintek/f81216h/f81216h.h
new file mode 100644
index 0000000..b57ad4f
--- /dev/null
+++ b/src/superio/fintek/f81216h/f81216h.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Advanced Micro Devices, Inc.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Datasheet:
+ * - Name: F81216H
+ */
+#ifndef SUPERIO_FINTEK_F81216_H
+#define SUPERIO_FINTEK_F81216_H
+
+/* Logical Device Numbers (LDN). */
+#define F81216H_SP1 0x00 /* UART1 */
+#define F81216H_SP2 0x01 /* UART2 */
+#define F81216H_SP3 0x02 /* UART3 */
+#define F81216H_SP4 0x03 /* UART4 */
+
+#endif
diff --git a/src/superio/fintek/f81216h/superio.c b/src/superio/fintek/f81216h/superio.c
new file mode 100644
index 0000000..02b5976
--- /dev/null
+++ b/src/superio/fintek/f81216h/superio.c
@@ -0,0 +1,102 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Advanced Micro Devices, Inc.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <arch/io.h>
+#include <device/device.h>
+#include <device/pnp.h>
+#include <console/console.h>
+#include <stdlib.h>
+#include "f81216h.h"
+
+static void pnp_enter_conf_state(device_t dev)
+{
+ outb(0x77, dev->path.pnp.port);
+ outb(0x77, dev->path.pnp.port);
+}
+
+static void pnp_exit_conf_state(device_t dev)
+{
+ outb(0xaa, dev->path.pnp.port);
+}
+
+static void f81216h_init(device_t dev)
+{
+ struct superio_fintek_f81216h_config *conf = dev->chip_info;
+
+ if (!dev->enabled)
+ return;
+
+ switch (dev->path.pnp.device) {
+ /* TODO: Might potentially need code for HWM or FDC etc. */
+ case F81216H_SP1:
+ case F81216H_SP2:
+ case F81216H_SP3:
+ case F81216H_SP4:
+ break;
+ }
+}
+
+static void f81216h_pnp_set_resources(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_set_resources(dev);
+ pnp_exit_conf_state(dev);
+}
+
+static void f81216h_pnp_enable_resources(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_enable_resources(dev);
+ pnp_exit_conf_state(dev);
+}
+
+static void f81216h_pnp_enable(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_set_logical_device(dev);
+ (dev->enabled) ? pnp_set_enable(dev, 1) : pnp_set_enable(dev, 0);
+ pnp_exit_conf_state(dev);
+}
+
+static struct device_operations ops = {
+ .read_resources = pnp_read_resources,
+ .set_resources = f81216h_pnp_set_resources,
+ .enable_resources = f81216h_pnp_enable_resources,
+ .enable = f81216h_pnp_enable,
+ .init = f81216h_init,
+};
+
+static struct pnp_info pnp_dev_info[] = {
+ /* TODO: Some of the 0x7f8 etc. values may not be correct. */
+ { &ops, F81216H_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
+ { &ops, F81216H_SP2, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
+// { &ops, F81216H_SP3, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
+// { &ops, F81216H_SP4, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
+};
+
+static void enable_dev(device_t dev)
+{
+ pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+}
+
+struct chip_operations superio_fintek_f81216h_ops = {
+ CHIP_NAME("Fintek F81216H Super I/O")
+ .enable_dev = enable_dev
+};
More information about the coreboot-gerrit
mailing list