blob: eef724290c387cce9c05ff43ee6b90adb6dd9ea6 [file] [log] [blame]
Nicola Corna2fca86f2017-03-02 08:08:45 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008 Corey Osgood <corey.osgood@gmail.com>
5 * Copyright (C) 2017 Nicola Corna <nicola@corna.info>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <arch/io.h>
19#include <device/device.h>
20#include <device/pnp.h>
21#include <superio/conf_mode.h>
22#include <console/console.h>
23#include <stdlib.h>
24#include <pc80/keyboard.h>
25
26#include "f71808a.h"
27#include "fintek_internal.h"
28
29static void f71808a_init(struct device *dev)
30{
31 if (!dev->enabled)
32 return;
33
34 switch (dev->path.pnp.device) {
35 /* TODO: Might potentially need code for UART, GPIO... */
36 case F71808A_KBC:
37 pc_keyboard_init(NO_AUX_DEVICE);
38 break;
39 case F71808A_HWM:
40 f71808a_multifunc_init(dev);
41 f71808a_hwm_init(dev);
42 break;
43 }
44}
45
46static struct device_operations ops = {
47 .read_resources = pnp_read_resources,
48 .set_resources = pnp_set_resources,
49 .enable_resources = pnp_enable_resources,
50 .enable = pnp_alt_enable,
51 .init = f71808a_init,
52 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
53};
54
55static struct pnp_info pnp_dev_info[] = {
56 /* TODO: Some of the 0x07f8 etc. values may not be correct. */
Samuel Holland7daac912017-06-06 22:55:01 -050057 { &ops, F71808A_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
58 { &ops, F71808A_HWM, PNP_IO0 | PNP_IRQ0, 0x07f8, },
59 { &ops, F71808A_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
Nicola Corna2fca86f2017-03-02 08:08:45 +010060 { &ops, F71808A_GPIO, PNP_IRQ0, },
Samuel Holland7daac912017-06-06 22:55:01 -050061 { &ops, F71808A_WDT, PNP_IO0, 0x07f8,},
62 { &ops, F71808A_CIR, PNP_IO0 | PNP_IRQ0, 0x07f8, },
Nicola Corna2fca86f2017-03-02 08:08:45 +010063 { &ops, F71808A_PME, },
64};
65
66static void enable_dev(struct device *dev)
67{
68 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
69}
70
71struct chip_operations superio_fintek_f71808a_ops = {
72 CHIP_NAME("Fintek F71808A Super I/O")
73 .enable_dev = enable_dev
74};