blob: 05132cc0ea53751f2a18404f865a986e8cdf3fc5 [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
Nicola Corna2fca86f2017-03-02 08:08:45 +010018#include <device/device.h>
19#include <device/pnp.h>
20#include <superio/conf_mode.h>
Nicola Corna2fca86f2017-03-02 08:08:45 +010021#include <pc80/keyboard.h>
22
23#include "f71808a.h"
24#include "fintek_internal.h"
25
26static void f71808a_init(struct device *dev)
27{
28 if (!dev->enabled)
29 return;
30
31 switch (dev->path.pnp.device) {
32 /* TODO: Might potentially need code for UART, GPIO... */
33 case F71808A_KBC:
34 pc_keyboard_init(NO_AUX_DEVICE);
35 break;
36 case F71808A_HWM:
37 f71808a_multifunc_init(dev);
38 f71808a_hwm_init(dev);
39 break;
40 }
41}
42
43static struct device_operations ops = {
44 .read_resources = pnp_read_resources,
45 .set_resources = pnp_set_resources,
46 .enable_resources = pnp_enable_resources,
47 .enable = pnp_alt_enable,
48 .init = f71808a_init,
49 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
50};
51
52static struct pnp_info pnp_dev_info[] = {
53 /* TODO: Some of the 0x07f8 etc. values may not be correct. */
Felix Held8ac8ac62018-07-06 21:43:34 +020054 { NULL, F71808A_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
55 { NULL, F71808A_HWM, PNP_IO0 | PNP_IRQ0, 0x07f8, },
56 { NULL, F71808A_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
57 { NULL, F71808A_GPIO, PNP_IRQ0, },
58 { NULL, F71808A_WDT, PNP_IO0, 0x07f8,},
59 { NULL, F71808A_CIR, PNP_IO0 | PNP_IRQ0, 0x07f8, },
60 { NULL, F71808A_PME, },
Nicola Corna2fca86f2017-03-02 08:08:45 +010061};
62
63static void enable_dev(struct device *dev)
64{
65 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
66}
67
68struct chip_operations superio_fintek_f71808a_ops = {
69 CHIP_NAME("Fintek F71808A Super I/O")
70 .enable_dev = enable_dev
71};