[coreboot-gerrit] Change in coreboot[master]: fintek/f81803a: Add new superio

John E. Kabat (Code Review) gerrit at coreboot.org
Wed Aug 16 16:26:26 CEST 2017


Hello Marshall Dawson, John E. Kabat Jr.,

I'd like you to do a code review. Please visit

    https://review.coreboot.org/21032

to review the following change.


Change subject: fintek/f81803a: Add new superio
......................................................................

fintek/f81803a: Add new superio

Add the F81803A device and model the source after the F81865F.

Change-Id: I2fb1a1d42d004123c3b12caf26cf0b03cd4046ec
Signed-off-by: John Kabat <john.kabat at scarletltd.com>
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/superio/fintek/Makefile.inc
A src/superio/fintek/f81803a/Kconfig
A src/superio/fintek/f81803a/Makefile.inc
A src/superio/fintek/f81803a/f81803a.h
A src/superio/fintek/f81803a/superio.c
5 files changed, 138 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/21032/1

diff --git a/src/superio/fintek/Makefile.inc b/src/superio/fintek/Makefile.inc
index 2222644..9bd0819 100644
--- a/src/superio/fintek/Makefile.inc
+++ b/src/superio/fintek/Makefile.inc
@@ -23,5 +23,6 @@
 subdirs-y += f71869ad
 subdirs-y += f71872
 subdirs-y += f81216h
+subdirs-y += f81803a
 subdirs-y += f81865f
 subdirs-y += f81866d
diff --git a/src/superio/fintek/f81803a/Kconfig b/src/superio/fintek/f81803a/Kconfig
new file mode 100644
index 0000000..6dbba97
--- /dev/null
+++ b/src/superio/fintek/f81803a/Kconfig
@@ -0,0 +1,19 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2009 Ronald G. Minnich
+## Copyright (C) 2014 Edward O'Callaghan <eocallaghan at alterapraxis.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
+## the Free Software Foundation; version 2 of the License.
+##
+## 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.
+##
+
+config SUPERIO_FINTEK_F81803A
+	bool
+	select SUPERIO_FINTEK_COMMON_ROMSTAGE
diff --git a/src/superio/fintek/f81803a/Makefile.inc b/src/superio/fintek/f81803a/Makefile.inc
new file mode 100644
index 0000000..9156bf9
--- /dev/null
+++ b/src/superio/fintek/f81803a/Makefile.inc
@@ -0,0 +1,17 @@
+##
+## 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.
+##
+
+ramstage-$(CONFIG_SUPERIO_FINTEK_F81803A) += superio.c
diff --git a/src/superio/fintek/f81803a/f81803a.h b/src/superio/fintek/f81803a/f81803a.h
new file mode 100644
index 0000000..ed78cab
--- /dev/null
+++ b/src/superio/fintek/f81803a/f81803a.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+/*
+ * Datasheet:
+ *  - Name: F81803A
+ */
+#ifndef SUPERIO_FINTEK_F81803_H
+#define SUPERIO_FINTEK_F81803_H
+
+/* Logical Device Numbers (LDN). */
+#define F81803A_SP1	0x01	/* UART1 */
+#define F81803A_SP2	0x02	/* UART2 */
+#define F81803A_HWM	0x04	/* Hardware Monitor */
+#define F81803A_KBC	0x05	/* Keyboard/Mouse */
+#define F81803A_GPIO	0x06	/* General Purpose I/O (GPIO) */
+#define F81803A_WDT	0x07	/* Watch Dog Timer */
+#define F81803A_PME	0x0a	/* Power Management Events (PME) */
+
+#endif /* SUPERIO_FINTEK_F81803_H */
diff --git a/src/superio/fintek/f81803a/superio.c b/src/superio/fintek/f81803a/superio.c
new file mode 100644
index 0000000..c5504c1
--- /dev/null
+++ b/src/superio/fintek/f81803a/superio.c
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+#include <arch/io.h>
+#include <device/device.h>
+#include <device/pnp.h>
+#include <superio/conf_mode.h>
+#include <console/console.h>
+#include <stdlib.h>
+#include <pc80/keyboard.h>
+#include "f81803a.h"
+
+static void f81803a_init(struct device *dev)
+{
+
+	if (!dev->enabled)
+		return;
+
+	switch (dev->path.pnp.device) {
+	/* TODO: Might potentially need code for HWM or FDC etc. */
+	case F81803A_KBC:
+		pc_keyboard_init(NO_AUX_DEVICE);
+		break;
+	}
+}
+
+static struct device_operations ops = {
+	.read_resources   = pnp_read_resources,
+	.set_resources    = pnp_set_resources,
+	.enable_resources = pnp_enable_resources,
+	.enable           = pnp_alt_enable,
+	.init             = f81803a_init,
+	.ops_pnp_mode     = &pnp_conf_mode_8787_aa,
+};
+
+static struct pnp_info pnp_dev_info[] = {
+	/* TODO: Some of the 0x7f8 etc. values may not be correct. */
+	{ &ops, F81803A_SP1,  PNP_IO0 | PNP_IRQ0, 0x7f8, },
+	{ &ops, F81803A_SP2,  PNP_IO0 | PNP_IRQ0, 0x7f8, },
+	{ &ops, F81803A_HWM,  PNP_IO0 | PNP_IRQ0, 0xff8, },
+	{ &ops, F81803A_KBC,  PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
+	{ &ops, F81803A_GPIO, PNP_IO0 | PNP_IRQ0, 0x7f8, },
+	{ &ops, F81803A_WDT, PNP_IO0, 0x7f8 },
+	{ &ops, F81803A_PME, },
+};
+
+static void enable_dev(struct device *dev)
+{
+	pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+}
+
+struct chip_operations superio_fintek_f81803a_ops = {
+	CHIP_NAME("Fintek F81803A Super I/O")
+	.enable_dev = enable_dev
+};

-- 
To view, visit https://review.coreboot.org/21032
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fb1a1d42d004123c3b12caf26cf0b03cd4046ec
Gerrit-Change-Number: 21032
Gerrit-PatchSet: 1
Gerrit-Owner: John E. Kabat <sljkrr at gmail.com>
Gerrit-Reviewer: John E. Kabat Jr. <john.kabat at scarletltd.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170816/2138942f/attachment.html>


More information about the coreboot-gerrit mailing list