blob: 70fefe50cbfaee77bd43e26a978369a152d004c8 [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
13 if (!dev->enabled)
14 return;
15
16 switch (dev->path.pnp.device) {
17 /* TODO: Might potentially need code for HWM or FDC etc. */
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000018 case F81865F_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060019 pc_keyboard_init(NO_AUX_DEVICE);
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000020 break;
21 }
22}
23
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000024static struct device_operations ops = {
25 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020026 .set_resources = pnp_set_resources,
27 .enable_resources = pnp_enable_resources,
28 .enable = pnp_alt_enable,
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000029 .init = f81865f_init,
Nico Huber1c811282013-06-15 20:33:44 +020030 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000031};
32
33static struct pnp_info pnp_dev_info[] = {
34 /* TODO: Some of the 0x7f8 etc. values may not be correct. */
Felix Held8ac8ac62018-07-06 21:43:34 +020035 { NULL, F81865F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
36 { NULL, F81865F_SP1, PNP_IO0 | PNP_IRQ0, 0x7f8, },
37 { NULL, F81865F_SP2, PNP_IO0 | PNP_IRQ0, 0x7f8, },
38 { NULL, F81865F_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
39 { NULL, F81865F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
40 { NULL, F81865F_HWM, PNP_IO0 | PNP_IRQ0, 0xff8, },
41 { NULL, F81865F_GPIO, PNP_IRQ0, },
42 { NULL, F81865F_PME, },
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000043};
44
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110045static void enable_dev(struct device *dev)
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000046{
47 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
48}
49
50struct chip_operations superio_fintek_f81865f_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090051 .name = "Fintek F81865F Super I/O",
Frank Vibransd0a8ebf2011-02-14 18:52:15 +000052 .enable_dev = enable_dev
53};