blob: 8ca66a0c9063496e2405dcd935cebccd3d5709d6 [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
Frank Vibransd0a8ebf2011-02-14 18:52:15 +00002
Frank Vibransd0a8ebf2011-02-14 18:52:15 +00003#include <device/device.h>
4#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +02005#include <superio/conf_mode.h>
Edward O'Callaghandef00be2014-04-30 05:01:52 +10006#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +02007
Frank Vibransd0a8ebf2011-02-14 18:52:15 +00008#include "f81865f.h"
9
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110010static void f81865f_init(struct device *dev)
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000011{
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000012 if (!dev->enabled)
13 return;
14
15 switch (dev->path.pnp.device) {
16 /* TODO: Might potentially need code for HWM or FDC etc. */
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000017 case F81865F_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060018 pc_keyboard_init(NO_AUX_DEVICE);
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000019 break;
20 }
21}
22
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000023static struct device_operations ops = {
24 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020025 .set_resources = pnp_set_resources,
26 .enable_resources = pnp_enable_resources,
27 .enable = pnp_alt_enable,
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000028 .init = f81865f_init,
Nico Huber1c811282013-06-15 20:33:44 +020029 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000030};
31
32static struct pnp_info pnp_dev_info[] = {
33 /* TODO: Some of the 0x7f8 etc. values may not be correct. */
Felix Held8ac8ac62018-07-06 21:43:34 +020034 { NULL, F81865F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
35 { NULL, F81865F_SP1, PNP_IO0 | PNP_IRQ0, 0x7f8, },
36 { NULL, F81865F_SP2, PNP_IO0 | PNP_IRQ0, 0x7f8, },
37 { NULL, F81865F_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
38 { NULL, F81865F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
39 { NULL, F81865F_HWM, PNP_IO0 | PNP_IRQ0, 0xff8, },
40 { NULL, F81865F_GPIO, PNP_IRQ0, },
41 { NULL, F81865F_PME, },
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000042};
43
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110044static void enable_dev(struct device *dev)
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000045{
46 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
47}
48
49struct chip_operations superio_fintek_f81865f_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090050 .name = "Fintek F81865F Super I/O",
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000051 .enable_dev = enable_dev
52};