blob: 28bfc8c4cdf0c6a5836ae9457719275165eaba01 [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
Richard Smith924f92f2006-07-29 17:40:36 +00002
Richard Smith924f92f2006-07-29 17:40:36 +00003#include <device/device.h>
4#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +02005#include <superio/conf_mode.h>
Richard Smith924f92f2006-07-29 17:40:36 +00006#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +02007
Richard Smith924f92f2006-07-29 17:40:36 +00008#include "w83977tf.h"
9
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110010static void w83977tf_init(struct device *dev)
Richard Smith924f92f2006-07-29 17:40:36 +000011{
Uwe Hermann340fa932010-11-10 14:53:36 +000012
13 if (!dev->enabled)
Richard Smith924f92f2006-07-29 17:40:36 +000014 return;
Uwe Hermann340fa932010-11-10 14:53:36 +000015
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010016 switch (dev->path.pnp.device) {
Richard Smith924f92f2006-07-29 17:40:36 +000017 case W83977TF_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060018 pc_keyboard_init(NO_AUX_DEVICE);
Richard Smith924f92f2006-07-29 17:40:36 +000019 break;
20 }
21}
22
Richard Smith924f92f2006-07-29 17:40:36 +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_enable,
Richard Smith924f92f2006-07-29 17:40:36 +000028 .init = w83977tf_init,
Nico Huber1c811282013-06-15 20:33:44 +020029 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Richard Smith924f92f2006-07-29 17:40:36 +000030};
31
32static struct pnp_info pnp_dev_info[] = {
Felix Held8c858802018-07-06 20:22:08 +020033 { NULL, W83977TF_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
34 { NULL, W83977TF_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
35 { NULL, W83977TF_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
36 { NULL, W83977TF_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
37 { NULL, W83977TF_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1,
38 0x07ff, 0x07ff, },
Keith Huif5472a12020-05-02 15:24:28 -040039#if CONFIG(W83977TF_HAVE_SEPARATE_IR_DEVICE)
Felix Held8c858802018-07-06 20:22:08 +020040 { NULL, W83977TF_CIR, PNP_IO0 | PNP_IRQ0, 0x07f8, },
Keith Huif5472a12020-05-02 15:24:28 -040041#endif
Felix Held8c858802018-07-06 20:22:08 +020042 { NULL, W83977TF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0,
43 0x07ff, 0x07fe, },
44 { NULL, W83977TF_ACPI, PNP_IRQ0, },
Richard Smith924f92f2006-07-29 17:40:36 +000045};
46
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110047static void enable_dev(struct device *dev)
Richard Smith924f92f2006-07-29 17:40:36 +000048{
Uwe Hermann340fa932010-11-10 14:53:36 +000049 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Richard Smith924f92f2006-07-29 17:40:36 +000050}
51
52struct chip_operations superio_winbond_w83977tf_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090053 .name = "Winbond W83977TF Super I/O",
Richard Smith924f92f2006-07-29 17:40:36 +000054 .enable_dev = enable_dev,
55};