blob: 6f1735d7a25988a83859a16df13bb7225cac6ccf [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
Wang Qing Pei42e7c322010-08-17 15:05:05 +00002
Wang Qing Pei42e7c322010-08-17 15:05:05 +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
Wang Qing Pei42e7c322010-08-17 15:05:05 +00008#include "f71863fg.h"
9
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110010static void f71863fg_init(struct device *dev)
Wang Qing Pei42e7c322010-08-17 15:05:05 +000011{
Wang Qing Pei42e7c322010-08-17 15:05:05 +000012 if (!dev->enabled)
13 return;
14
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010015 switch (dev->path.pnp.device) {
Wang Qing Pei42e7c322010-08-17 15:05:05 +000016 /* TODO: Might potentially need code for HWM or FDC etc. */
Uwe Hermann7d341882010-11-05 00:07:13 +000017 case F71863FG_KBC:
Elyes HAOUASd3872fc2019-05-24 17:54:29 +020018 find_resource(dev, PNP_IDX_IO0);
Timothy Pearson448e3862015-11-24 14:12:01 -060019 pc_keyboard_init(NO_AUX_DEVICE);
Uwe Hermann7d341882010-11-05 00:07:13 +000020 break;
Wang Qing Pei42e7c322010-08-17 15:05:05 +000021 }
22}
23
Wang Qing Pei42e7c322010-08-17 15:05:05 +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,
Wang Qing Pei42e7c322010-08-17 15:05:05 +000029 .init = f71863fg_init,
Nico Huber1c811282013-06-15 20:33:44 +020030 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Wang Qing Pei42e7c322010-08-17 15:05:05 +000031};
32
33static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000034 /* TODO: Some of the 0x07f8 etc. values may not be correct. */
Felix Held8ac8ac62018-07-06 21:43:34 +020035 { NULL, F71863FG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
36 { NULL, F71863FG_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
37 { NULL, F71863FG_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
38 { NULL, F71863FG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
39 { NULL, F71863FG_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
40 { NULL, F71863FG_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
41 { NULL, F71863FG_GPIO, },
42 { NULL, F71863FG_VID, PNP_IO0, 0x07f8, },
43 { NULL, F71863FG_SPI, },
44 { NULL, F71863FG_PME, },
Wang Qing Pei42e7c322010-08-17 15:05:05 +000045};
46
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110047static void enable_dev(struct device *dev)
Wang Qing Pei42e7c322010-08-17 15:05:05 +000048{
49 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
50}
51
52struct chip_operations superio_fintek_f71863fg_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090053 .name = "Fintek F71863FG Super I/O",
Wang Qing Pei42e7c322010-08-17 15:05:05 +000054 .enable_dev = enable_dev
55};