blob: 875a4a89b54bef8603f642fede20e60737302bf3 [file] [log] [blame]
Zheng Bao9db833b2009-12-28 09:59:44 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2000 AG Electronics Ltd.
5 * Copyright (C) 2003-2004 Linux Networx
Uwe Hermann340fa932010-11-10 14:53:36 +00006 * Copyright (C) 2004 Tyan
Zheng Bao9db833b2009-12-28 09:59:44 +00007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Zheng Bao9db833b2009-12-28 09:59:44 +000017 */
Stefan Reinauerb70d1992008-10-29 04:45:28 +000018
Stefan Reinauerb70d1992008-10-29 04:45:28 +000019#include <device/device.h>
20#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020021#include <superio/conf_mode.h>
Stefan Reinauerb70d1992008-10-29 04:45:28 +000022#include <pc80/keyboard.h>
Stefan Reinauerb70d1992008-10-29 04:45:28 +000023#include "w83627thg.h"
24
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110025static void w83627thg_init(struct device *dev)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000026{
Uwe Hermann340fa932010-11-10 14:53:36 +000027
28 if (!dev->enabled)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000029 return;
Uwe Hermann340fa932010-11-10 14:53:36 +000030
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010031 switch (dev->path.pnp.device) {
Stefan Reinauerb70d1992008-10-29 04:45:28 +000032 case W83627THG_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060033 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauerb70d1992008-10-29 04:45:28 +000034 break;
35 }
36}
37
Stefan Reinauerb70d1992008-10-29 04:45:28 +000038static struct device_operations ops = {
39 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020040 .set_resources = pnp_set_resources,
41 .enable_resources = pnp_enable_resources,
42 .enable = pnp_enable,
Stefan Reinauerb70d1992008-10-29 04:45:28 +000043 .init = w83627thg_init,
Nico Huber1c811282013-06-15 20:33:44 +020044 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Stefan Reinauerb70d1992008-10-29 04:45:28 +000045};
46
47static struct pnp_info pnp_dev_info[] = {
Felix Held8c858802018-07-06 20:22:08 +020048 { NULL, W83627THG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
49 { NULL, W83627THG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
50 { NULL, W83627THG_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
51 { NULL, W83627THG_SP2, PNP_IO0 | PNP_IRQ0 | PNP_MSC1, 0x07f8, },
52 { NULL, W83627THG_KBC,
53 PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1 | PNP_MSC0,
54 0x07ff, 0x07ff, },
55 { NULL, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0,
56 0x07ff, 0x07fe, },
57 { NULL, W83627THG_GPIO2, },
58 { NULL, W83627THG_GPIO3, PNP_EN | PNP_MSC0 | PNP_MSC1, },
59 { NULL, W83627THG_ACPI, PNP_IRQ0, },
60 { NULL, W83627THG_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
Stefan Reinauerb70d1992008-10-29 04:45:28 +000061};
62
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110063static void enable_dev(struct device *dev)
Stefan Reinauerb70d1992008-10-29 04:45:28 +000064{
Uwe Hermann340fa932010-11-10 14:53:36 +000065 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauerb70d1992008-10-29 04:45:28 +000066}
67
68struct chip_operations superio_winbond_w83627thg_ops = {
69 CHIP_NAME("Winbond W83627THG Super I/O")
70 .enable_dev = enable_dev,
71};