[coreboot-gerrit] New patch to review for coreboot: 1b7e594 superio/fintek/f71869ad: Provide devicetree conf of multi-func reg

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Wed Apr 23 19:00:41 CEST 2014


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5576

-gerrit

commit 1b7e59449e85a27d92b74454240895059b739f26
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Thu Apr 24 02:58:11 2014 +1000

    superio/fintek/f71869ad: Provide devicetree conf of multi-func reg
    
    Facilitate for the configuration of so called "Multi-function Select
    Registers" with devicetree.cb in ramstage.
    
    Change-Id: I80abcd8b767fc4b22d00d1384ce4ef89fe837e3d
    Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 src/superio/fintek/f71869ad/Makefile.inc         |  1 +
 src/superio/fintek/f71869ad/chip.h               |  2 +
 src/superio/fintek/f71869ad/f71869ad_multifunc.c | 52 ++++++++++++++++++++++++
 src/superio/fintek/f71869ad/fintek_chip.h        | 40 ++++++++++++++++++
 src/superio/fintek/f71869ad/superio.c            |  4 ++
 5 files changed, 99 insertions(+)

diff --git a/src/superio/fintek/f71869ad/Makefile.inc b/src/superio/fintek/f71869ad/Makefile.inc
index 117239a..87d96e4 100644
--- a/src/superio/fintek/f71869ad/Makefile.inc
+++ b/src/superio/fintek/f71869ad/Makefile.inc
@@ -18,4 +18,5 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 ##
 
+ramstage-$(CONFIG_SUPERIO_FINTEK_F71869AD) += f71869ad_multifunc.c
 ramstage-$(CONFIG_SUPERIO_FINTEK_F71869AD) += superio.c
diff --git a/src/superio/fintek/f71869ad/chip.h b/src/superio/fintek/f71869ad/chip.h
index ea2ee6e..9a427fb 100644
--- a/src/superio/fintek/f71869ad/chip.h
+++ b/src/superio/fintek/f71869ad/chip.h
@@ -22,9 +22,11 @@
 #define SUPERIO_FINTEK_F71869AD_CHIP_H
 
 #include <pc80/keyboard.h>
+#include "fintek_chip.h"
 
 struct superio_fintek_f71869ad_config {
 	struct pc_keyboard keyboard;
+	struct superio_fintek_config multifunc;
 };
 
 #endif /* SUPERIO_FINTEK_F71869AD_CHIP_H */
diff --git a/src/superio/fintek/f71869ad/f71869ad_multifunc.c b/src/superio/fintek/f71869ad/f71869ad_multifunc.c
new file mode 100644
index 0000000..fb972d4
--- /dev/null
+++ b/src/superio/fintek/f71869ad/f71869ad_multifunc.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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; 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 "fintek_chip.h"
+
+#define MULTI_FUNC_SEL_REG1 0x28
+#define MULTI_FUNC_SEL_REG2 0x29
+#define MULTI_FUNC_SEL_REG3 0x2A
+#define MULTI_FUNC_SEL_REG4 0x2B
+#define MULTI_FUNC_SEL_REG5 0x2C
+
+void f71869ad_multifunc_init(device_t dev, struct superio_fintek_config * conf)
+{
+	pnp_enable_resources(dev);
+	pnp_enter_conf_mode(dev);
+
+	printk(BIOS_DEBUG,
+		"Fintek Super I/O: Configuring Multi-function Registers..\n");
+
+	/* multi-func select reg1 */
+	pnp_write_config(dev, MULTI_FUNC_SEL_REG1, multi_function_register_1);
+	/* multi-func select reg2 (CLK_TUNE_EN=0) */
+	pnp_write_config(dev, MULTI_FUNC_SEL_REG2, multi_function_register_2);
+	/* multi-func select reg3 (CLK_TUNE_EN=0) */
+	pnp_write_config(dev, MULTI_FUNC_SEL_REG3, multi_function_register_3);
+	/* multi-func select reg4 (CLK_TUNE_EN=0) */
+	pnp_write_config(dev, MULTI_FUNC_SEL_REG4, multi_function_register_4);
+	/* multi-func select reg5 (CLK_TUNE_EN=0) */
+	pnp_write_config(dev, MULTI_FUNC_SEL_REG5, multi_function_register_5);
+
+	pnp_exit_conf_mode(dev);
+}
diff --git a/src/superio/fintek/f71869ad/fintek_chip.h b/src/superio/fintek/f71869ad/fintek_chip.h
new file mode 100644
index 0000000..3316718
--- /dev/null
+++ b/src/superio/fintek/f71869ad/fintek_chip.h
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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; 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_CHIP_H
+#define SUPERIO_FINTEK_CHIP_H
+
+#include <arch/io.h>
+#include <device/pnp.h>
+#include <stdint.h>
+
+/* Member variables are defined in devicetree.cb. */
+struct superio_fintek_config
+{
+	u8 multi_function_register_1;
+	u8 multi_function_register_2;
+	u8 multi_function_register_3;
+	u8 multi_function_register_4;
+	u8 multi_function_register_5;
+};
+
+void f71869ad_multifunc_init(device_t dev, struct superio_fintek_config * conf);
+
+#endif /* SUPERIO_FINTEK_CHIP_H */
diff --git a/src/superio/fintek/f71869ad/superio.c b/src/superio/fintek/f71869ad/superio.c
index 11ad6f8..bc63f7e 100644
--- a/src/superio/fintek/f71869ad/superio.c
+++ b/src/superio/fintek/f71869ad/superio.c
@@ -25,6 +25,7 @@
 #include <console/console.h>
 #include <stdlib.h>
 
+#include "fintek_chip.h"
 #include "chip.h"
 #include "f71869ad.h"
 
@@ -40,6 +41,9 @@ static void f71869ad_init(device_t dev)
 	case F71869AD_KBC:
 		pc_keyboard_init(&conf->keyboard);
 		break;
+	case F71869AD_HWM:
+		f71869ad_multifunc_init(dev, &conf->multifunc);
+		break;
 	}
 }
 



More information about the coreboot-gerrit mailing list