blob: c6fa7d06cbb5bd77dad661fd89475e814efef034 [file] [log] [blame]
Jonathan Kollaschab940df2010-11-11 22:25:55 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008 Corey Osgood <corey.osgood@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Jonathan Kollaschab940df2010-11-11 22:25:55 +000019 */
20
21#include <arch/io.h>
22#include <device/device.h>
23#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020024#include <superio/conf_mode.h>
Jonathan Kollaschab940df2010-11-11 22:25:55 +000025#include <console/console.h>
26#include <stdlib.h>
Edward O'Callaghandef00be2014-04-30 05:01:52 +100027#include <pc80/keyboard.h>
Jonathan Kollaschab940df2010-11-11 22:25:55 +000028#include "f71872.h"
29
Jonathan Kollaschab940df2010-11-11 22:25:55 +000030static void f71872_init(device_t dev)
31{
Jonathan Kollaschab940df2010-11-11 22:25:55 +000032
33 if (!dev->enabled)
34 return;
35
36 switch(dev->path.pnp.device) {
37 /* TODO: Might potentially need code for HWM or FDC etc. */
Jonathan Kollaschab940df2010-11-11 22:25:55 +000038 case F71872_KBC:
Edward O'Callaghandef00be2014-04-30 05:01:52 +100039 pc_keyboard_init();
Jonathan Kollaschab940df2010-11-11 22:25:55 +000040 break;
41 }
42}
43
Jonathan Kollaschab940df2010-11-11 22:25:55 +000044static struct device_operations ops = {
45 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020046 .set_resources = pnp_set_resources,
47 .enable_resources = pnp_enable_resources,
48 .enable = pnp_alt_enable,
Jonathan Kollaschab940df2010-11-11 22:25:55 +000049 .init = f71872_init,
Nico Huber1c811282013-06-15 20:33:44 +020050 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Jonathan Kollaschab940df2010-11-11 22:25:55 +000051};
52
53static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000054 /* TODO: Some of the 0x07f8 etc. values may not be correct. */
55 { &ops, F71872_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
56 { &ops, F71872_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
57 { &ops, F71872_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
58 { &ops, F71872_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
59 { &ops, F71872_HWM, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, },
60 { &ops, F71872_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, {0x07ff, 0}, },
Jonathan Kollaschab940df2010-11-11 22:25:55 +000061 { &ops, F71872_GPIO, PNP_IRQ0, },
Uwe Hermanna69d9782010-11-15 19:35:14 +000062 { &ops, F71872_VID, PNP_IO0, {0x0ff8, 0}, },
Jonathan Kollaschab940df2010-11-11 22:25:55 +000063 { &ops, F71872_PM, },
64};
65
66static void enable_dev(device_t dev)
67{
68 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
69}
70
71struct chip_operations superio_fintek_f71872_ops = {
72 CHIP_NAME("Fintek F71872 Super I/O")
73 .enable_dev = enable_dev
74};