blob: 45520f8b1bdf3b2249243dfa01ad428d1e758cdc [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 */
Richard Smith924f92f2006-07-29 17:40:36 +000018
Richard Smith924f92f2006-07-29 17:40:36 +000019#include <arch/io.h>
20#include <device/device.h>
21#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020022#include <superio/conf_mode.h>
Richard Smith924f92f2006-07-29 17:40:36 +000023#include <console/console.h>
24#include <string.h>
Richard Smith924f92f2006-07-29 17:40:36 +000025#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000026#include <stdlib.h>
Richard Smith924f92f2006-07-29 17:40:36 +000027#include "w83977tf.h"
28
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110029static void w83977tf_init(struct device *dev)
Richard Smith924f92f2006-07-29 17:40:36 +000030{
Uwe Hermann340fa932010-11-10 14:53:36 +000031
32 if (!dev->enabled)
Richard Smith924f92f2006-07-29 17:40:36 +000033 return;
Uwe Hermann340fa932010-11-10 14:53:36 +000034
Stefan Reinauer2b34db82009-02-28 20:10:20 +000035 switch(dev->path.pnp.device) {
Richard Smith924f92f2006-07-29 17:40:36 +000036 case W83977TF_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060037 pc_keyboard_init(NO_AUX_DEVICE);
Richard Smith924f92f2006-07-29 17:40:36 +000038 break;
39 }
40}
41
Richard Smith924f92f2006-07-29 17:40:36 +000042static struct device_operations ops = {
43 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020044 .set_resources = pnp_set_resources,
45 .enable_resources = pnp_enable_resources,
46 .enable = pnp_enable,
Richard Smith924f92f2006-07-29 17:40:36 +000047 .init = w83977tf_init,
Nico Huber1c811282013-06-15 20:33:44 +020048 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Richard Smith924f92f2006-07-29 17:40:36 +000049};
50
51static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000052 { &ops, W83977TF_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
53 { &ops, W83977TF_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
54 { &ops, W83977TF_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
55 { &ops, W83977TF_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
56 { &ops, W83977TF_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, {0x07ff, 0}, {0x07ff, 4}, },
57 { &ops, W83977TF_CIR, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
58 { &ops, W83977TF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07ff, 0}, {0x07fe, 4}, },
59 { &ops, W83977TF_ACPI, PNP_IRQ0, },
Richard Smith924f92f2006-07-29 17:40:36 +000060};
61
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110062static void enable_dev(struct device *dev)
Richard Smith924f92f2006-07-29 17:40:36 +000063{
Uwe Hermann340fa932010-11-10 14:53:36 +000064 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Richard Smith924f92f2006-07-29 17:40:36 +000065}
66
67struct chip_operations superio_winbond_w83977tf_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000068 CHIP_NAME("Winbond W83977TF Super I/O")
Richard Smith924f92f2006-07-29 17:40:36 +000069 .enable_dev = enable_dev,
70};