blob: d70ed0181e520e9e37b32f237cac140211267ce6 [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. */
Stefan Reinauerb70d1992008-10-29 04:45:28 +00003
Stefan Reinauerb70d1992008-10-29 04:45:28 +00004#include <device/device.h>
5#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +02006#include <superio/conf_mode.h>
Stefan Reinauerb70d1992008-10-29 04:45:28 +00007#include <pc80/keyboard.h>
Stefan Reinauerb70d1992008-10-29 04:45:28 +00008#include "w83627thg.h"
9
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110010static void w83627thg_init(struct device *dev)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000011{
Uwe Hermann340fa932010-11-10 14:53:36 +000012
13 if (!dev->enabled)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000014 return;
Uwe Hermann340fa932010-11-10 14:53:36 +000015
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010016 switch (dev->path.pnp.device) {
Stefan Reinauerb70d1992008-10-29 04:45:28 +000017 case W83627THG_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060018 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauerb70d1992008-10-29 04:45:28 +000019 break;
20 }
21}
22
Stefan Reinauerb70d1992008-10-29 04:45:28 +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,
Stefan Reinauerb70d1992008-10-29 04:45:28 +000028 .init = w83627thg_init,
Nico Huber1c811282013-06-15 20:33:44 +020029 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Stefan Reinauerb70d1992008-10-29 04:45:28 +000030};
31
32static struct pnp_info pnp_dev_info[] = {
Felix Held8c858802018-07-06 20:22:08 +020033 { NULL, W83627THG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
34 { NULL, W83627THG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
35 { NULL, W83627THG_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
36 { NULL, W83627THG_SP2, PNP_IO0 | PNP_IRQ0 | PNP_MSC1, 0x07f8, },
37 { NULL, W83627THG_KBC,
38 PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1 | PNP_MSC0,
39 0x07ff, 0x07ff, },
40 { NULL, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0,
41 0x07ff, 0x07fe, },
42 { NULL, W83627THG_GPIO2, },
43 { NULL, W83627THG_GPIO3, PNP_EN | PNP_MSC0 | PNP_MSC1, },
44 { NULL, W83627THG_ACPI, PNP_IRQ0, },
45 { NULL, W83627THG_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
Stefan Reinauerb70d1992008-10-29 04:45:28 +000046};
47
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110048static void enable_dev(struct device *dev)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000049{
Uwe Hermann340fa932010-11-10 14:53:36 +000050 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauerb70d1992008-10-29 04:45:28 +000051}
52
53struct chip_operations superio_winbond_w83627thg_ops = {
54 CHIP_NAME("Winbond W83627THG Super I/O")
55 .enable_dev = enable_dev,
56};