blob: b56bb9c325e49a9b0494043e4ca5028f662e7cb8 [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* This file is part of the coreboot project. */
Richard Smith924f92f2006-07-29 17:40:36 +00003
Richard Smith924f92f2006-07-29 17:40:36 +00004#include <device/device.h>
5#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +02006#include <superio/conf_mode.h>
Richard Smith924f92f2006-07-29 17:40:36 +00007#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +02008
Richard Smith924f92f2006-07-29 17:40:36 +00009#include "w83977tf.h"
10
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110011static void w83977tf_init(struct device *dev)
Richard Smith924f92f2006-07-29 17:40:36 +000012{
Uwe Hermann340fa932010-11-10 14:53:36 +000013
14 if (!dev->enabled)
Richard Smith924f92f2006-07-29 17:40:36 +000015 return;
Uwe Hermann340fa932010-11-10 14:53:36 +000016
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010017 switch (dev->path.pnp.device) {
Richard Smith924f92f2006-07-29 17:40:36 +000018 case W83977TF_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060019 pc_keyboard_init(NO_AUX_DEVICE);
Richard Smith924f92f2006-07-29 17:40:36 +000020 break;
21 }
22}
23
Richard Smith924f92f2006-07-29 17:40:36 +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_enable,
Richard Smith924f92f2006-07-29 17:40:36 +000029 .init = w83977tf_init,
Nico Huber1c811282013-06-15 20:33:44 +020030 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Richard Smith924f92f2006-07-29 17:40:36 +000031};
32
33static struct pnp_info pnp_dev_info[] = {
Felix Held8c858802018-07-06 20:22:08 +020034 { NULL, W83977TF_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
35 { NULL, W83977TF_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
36 { NULL, W83977TF_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
37 { NULL, W83977TF_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
38 { NULL, W83977TF_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1,
39 0x07ff, 0x07ff, },
40 { NULL, W83977TF_CIR, PNP_IO0 | PNP_IRQ0, 0x07f8, },
41 { NULL, W83977TF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0,
42 0x07ff, 0x07fe, },
43 { NULL, W83977TF_ACPI, PNP_IRQ0, },
Richard Smith924f92f2006-07-29 17:40:36 +000044};
45
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110046static void enable_dev(struct device *dev)
Richard Smith924f92f2006-07-29 17:40:36 +000047{
Uwe Hermann340fa932010-11-10 14:53:36 +000048 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Richard Smith924f92f2006-07-29 17:40:36 +000049}
50
51struct chip_operations superio_winbond_w83977tf_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000052 CHIP_NAME("Winbond W83977TF Super I/O")
Richard Smith924f92f2006-07-29 17:40:36 +000053 .enable_dev = enable_dev,
54};