blob: 156239f1a3389f7350ab0917415bfe8aa9dce055 [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
Stefan Reinauerb70d1992008-10-29 04:45:28 +00002
Stefan Reinauerb70d1992008-10-29 04:45:28 +00003#include <device/device.h>
4#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +02005#include <superio/conf_mode.h>
Stefan Reinauerb70d1992008-10-29 04:45:28 +00006#include <pc80/keyboard.h>
Stefan Reinauerb70d1992008-10-29 04:45:28 +00007#include "w83627thg.h"
8
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +11009static void w83627thg_init(struct device *dev)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000010{
Uwe Hermann340fa932010-11-10 14:53:36 +000011
12 if (!dev->enabled)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000013 return;
Uwe Hermann340fa932010-11-10 14:53:36 +000014
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010015 switch (dev->path.pnp.device) {
Stefan Reinauerb70d1992008-10-29 04:45:28 +000016 case W83627THG_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060017 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauerb70d1992008-10-29 04:45:28 +000018 break;
19 }
20}
21
Stefan Reinauerb70d1992008-10-29 04:45:28 +000022static struct device_operations ops = {
23 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020024 .set_resources = pnp_set_resources,
25 .enable_resources = pnp_enable_resources,
26 .enable = pnp_enable,
Stefan Reinauerb70d1992008-10-29 04:45:28 +000027 .init = w83627thg_init,
Nico Huber1c811282013-06-15 20:33:44 +020028 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Stefan Reinauerb70d1992008-10-29 04:45:28 +000029};
30
31static struct pnp_info pnp_dev_info[] = {
Felix Held8c858802018-07-06 20:22:08 +020032 { NULL, W83627THG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
33 { NULL, W83627THG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
34 { NULL, W83627THG_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
35 { NULL, W83627THG_SP2, PNP_IO0 | PNP_IRQ0 | PNP_MSC1, 0x07f8, },
36 { NULL, W83627THG_KBC,
37 PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1 | PNP_MSC0,
38 0x07ff, 0x07ff, },
39 { NULL, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0,
40 0x07ff, 0x07fe, },
41 { NULL, W83627THG_GPIO2, },
42 { NULL, W83627THG_GPIO3, PNP_EN | PNP_MSC0 | PNP_MSC1, },
43 { NULL, W83627THG_ACPI, PNP_IRQ0, },
44 { NULL, W83627THG_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
Stefan Reinauerb70d1992008-10-29 04:45:28 +000045};
46
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110047static void enable_dev(struct device *dev)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000048{
Uwe Hermann340fa932010-11-10 14:53:36 +000049 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauerb70d1992008-10-29 04:45:28 +000050}
51
52struct chip_operations superio_winbond_w83627thg_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090053 .name = "Winbond W83627THG Super I/O",
Stefan Reinauerb70d1992008-10-29 04:45:28 +000054 .enable_dev = enable_dev,
55};