blob: d62fc82793aaa29581fa13d0ca392635fdf70878 [file] [log] [blame]
Frank Vibransd0a8ebf2011-02-14 18:52:15 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
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.
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000015 */
16
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000017#include <device/device.h>
18#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020019#include <superio/conf_mode.h>
Edward O'Callaghandef00be2014-04-30 05:01:52 +100020#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +020021
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000022#include "f81865f.h"
23
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110024static void f81865f_init(struct device *dev)
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000025{
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000026
27 if (!dev->enabled)
28 return;
29
30 switch (dev->path.pnp.device) {
31 /* TODO: Might potentially need code for HWM or FDC etc. */
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000032 case F81865F_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060033 pc_keyboard_init(NO_AUX_DEVICE);
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000034 break;
35 }
36}
37
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000038static struct device_operations ops = {
39 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020040 .set_resources = pnp_set_resources,
41 .enable_resources = pnp_enable_resources,
42 .enable = pnp_alt_enable,
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000043 .init = f81865f_init,
Nico Huber1c811282013-06-15 20:33:44 +020044 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000045};
46
47static struct pnp_info pnp_dev_info[] = {
48 /* TODO: Some of the 0x7f8 etc. values may not be correct. */
Felix Held8ac8ac62018-07-06 21:43:34 +020049 { NULL, F81865F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
50 { NULL, F81865F_SP1, PNP_IO0 | PNP_IRQ0, 0x7f8, },
51 { NULL, F81865F_SP2, PNP_IO0 | PNP_IRQ0, 0x7f8, },
52 { NULL, F81865F_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
53 { NULL, F81865F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
54 { NULL, F81865F_HWM, PNP_IO0 | PNP_IRQ0, 0xff8, },
55 { NULL, F81865F_GPIO, PNP_IRQ0, },
56 { NULL, F81865F_PME, },
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000057};
58
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110059static void enable_dev(struct device *dev)
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000060{
61 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
62}
63
64struct chip_operations superio_fintek_f81865f_ops = {
65 CHIP_NAME("Fintek F81865F Super I/O")
66 .enable_dev = enable_dev
67};