[coreboot-gerrit] Patch set updated for coreboot: 7f9e733 Super I/O: Add support for Fintek F81216H

Bruce Griffith (Bruce.Griffith@se-eng.com) gerrit at coreboot.org
Wed Oct 29 11:32:03 CET 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 7f9e7330816a81253c6c23863a32f736eae5ed19
Author: Bruce Griffith <Bruce.Griffith at se-eng.com>
Date:   Sun Jul 20 00:02:44 2014 -0600

    Super I/O: Add support for Fintek F81216H
    
    This chip is used on AMD's Lamar board.  This is pretty much a
    minimal implementation to get this super I/O working for serial
    port debugging.
    
    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           |  22 +++++
 src/superio/fintek/f81216h/chip.h                 |  29 +++++++
 src/superio/fintek/f81216h/f81216h.h              |  36 ++++++++
 src/superio/fintek/f81216h/f81216h_early_serial.c |  48 ++++++++++
 src/superio/fintek/f81216h/superio.c              | 101 ++++++++++++++++++++++
 7 files changed, 240 insertions(+)

diff --git a/src/superio/fintek/Kconfig b/src/superio/fintek/Kconfig
index f577898..bb1e827 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
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..be5272d
--- /dev/null
+++ b/src/superio/fintek/f81216h/Makefile.inc
@@ -0,0 +1,22 @@
+##
+## 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
+##
+
+romstage-$(CONFIG_SUPERIO_FINTEK_F81216H) += f81216h_early_serial.c
+ramstage-$(CONFIG_SUPERIO_FINTEK_F81216H) += superio.c
diff --git a/src/superio/fintek/f81216h/chip.h b/src/superio/fintek/f81216h/chip.h
new file mode 100644
index 0000000..41cf314
--- /dev/null
+++ b/src/superio/fintek/f81216h/chip.h
@@ -0,0 +1,29 @@
+/*
+ * 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
+ */
+
+#ifndef SUPERIO_FINTEK_F81216_CHIP_H
+#define SUPERIO_FINTEK_F81216_CHIP_H
+
+/* This chip doesn't have keyboard or mouse support. */
+
+struct superio_fintek_f81216h_config {
+};
+
+#endif
diff --git a/src/superio/fintek/f81216h/f81216h.h b/src/superio/fintek/f81216h/f81216h.h
new file mode 100644
index 0000000..5530678
--- /dev/null
+++ b/src/superio/fintek/f81216h/f81216h.h
@@ -0,0 +1,36 @@
+/*
+ * 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_F81216_H
+#define SUPERIO_FINTEK_F81216_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 */
+
+void f81216h_enable_serial(device_t dev, u16 iobase);
+
+#endif
diff --git a/src/superio/fintek/f81216h/f81216h_early_serial.c b/src/superio/fintek/f81216h/f81216h_early_serial.c
new file mode 100644
index 0000000..b5e5be3
--- /dev/null
+++ b/src/superio/fintek/f81216h/f81216h_early_serial.c
@@ -0,0 +1,48 @@
+/*
+ * 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
+ */
+
+/* Pre-RAM driver for the Fintek F81216F/FG Super I/O chip. */
+
+#include <arch/io.h>
+#include <device/pnp_def.h>
+#include "f81216h.h"
+
+static void pnp_enter_conf_state(device_t dev)
+{
+	u16 port = dev >> 8;
+	outb(0x77, port);
+	outb(0x77, port);
+}
+
+static void pnp_exit_conf_state(device_t dev)
+{
+	u16 port = dev >> 8;
+	outb(0xaa, port);
+}
+
+void f81216h_enable_serial(device_t dev, u16 iobase)
+{
+	pnp_enter_conf_state(dev);
+	pnp_set_logical_device(dev);
+	pnp_set_enable(dev, 0);
+	pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
+	pnp_set_enable(dev, 1);
+	pnp_exit_conf_state(dev);
+}
diff --git a/src/superio/fintek/f81216h/superio.c b/src/superio/fintek/f81216h/superio.c
new file mode 100644
index 0000000..83f4886
--- /dev/null
+++ b/src/superio/fintek/f81216h/superio.c
@@ -0,0 +1,101 @@
+/*
+ * 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 "chip.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)
+{
+	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