blob: 9a950e32f480e8bed3193071af18bb2bcdb5ab83 [file] [log] [blame]
Stefan Reinauer6af77ae2006-08-25 19:29:57 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Uwe Hermanna4c56c32006-11-01 14:31:00 +00003 *
Stefan Reinauer6af77ae2006-08-25 19:29:57 +00004 * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de>
Philipp Degler4adc7422007-05-24 18:44:50 +00005 * Copyright (C) 2007 Philipp Degler <pdegler@rumms.uni-mannheim.de>
Stefan Reinauer6af77ae2006-08-25 19:29:57 +00006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000016 */
17
Jon Dufresne39b13f42006-12-01 09:41:11 +000018#include <device/device.h>
19#include <device/pnp.h>
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000020#include <pc80/keyboard.h>
Philipp Degler4adc7422007-05-24 18:44:50 +000021#include <arch/io.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000022#include <stdlib.h>
Edward O'Callaghan0f7ec312014-11-01 12:11:58 +110023#include <superio/conf_mode.h>
24
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000025#include "it8712f.h"
26
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110027static void it8712f_init(struct device *dev)
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000028{
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000029
Uwe Hermann5c6bae22010-11-08 15:16:30 +000030 if (!dev->enabled)
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000031 return;
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000032
Stefan Reinauer2b34db82009-02-28 20:10:20 +000033 switch (dev->path.pnp.device) {
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000034 case IT8712F_FDC: /* TODO. */
35 break;
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000036 case IT8712F_PP: /* TODO. */
37 break;
38 case IT8712F_EC: /* TODO. */
39 break;
40 case IT8712F_KBCK:
Marc Jonesecd176f2008-09-26 19:15:38 +000041 set_kbc_ps2_mode();
Timothy Pearson448e3862015-11-24 14:12:01 -060042 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000043 break;
44 case IT8712F_KBCM: /* TODO. */
45 break;
46 case IT8712F_MIDI: /* TODO. */
47 break;
48 case IT8712F_GAME: /* TODO. */
49 break;
50 case IT8712F_IR: /* TODO. */
51 break;
52 }
53}
54
55static struct device_operations ops = {
Nico Huber9cb09412013-06-15 15:30:19 +020056 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020057 .set_resources = pnp_set_resources,
58 .enable_resources = pnp_enable_resources,
59 .enable = pnp_alt_enable,
Nico Huber9cb09412013-06-15 15:30:19 +020060 .init = it8712f_init,
Edward O'Callaghan0f7ec312014-11-01 12:11:58 +110061 .ops_pnp_mode = &pnp_conf_mode_870155_aa,
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000062};
63
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000064static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000065 { &ops, IT8712F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x0ff8, 0}, },
66 { &ops, IT8712F_SP1, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, },
67 { &ops, IT8712F_SP2, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, },
68 { &ops, IT8712F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x0ffc, 0}, },
69 { &ops, IT8712F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x0ff8, 0}, {0x0ff8, 4}, },
70 { &ops, IT8712F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x0fff, 0}, {0x0fff, 4}, },
71 { &ops, IT8712F_KBCM, PNP_IRQ0, },
72 { &ops, IT8712F_GPIO, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IRQ0, {0x0fff, 0}, {0x0ff8, 0}, {0x0ff8, 0}, },
73 { &ops, IT8712F_MIDI, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, },
74 { &ops, IT8712F_GAME, PNP_IO0, {0x0fff, 0}, },
75 { &ops, IT8712F_IR, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, },
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000076};
77
78static void enable_dev(struct device *dev)
79{
80 pnp_enable_devices(dev, &pnp_ops,
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000081 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000082}
83
Uwe Hermannf28674e2006-11-01 12:52:49 +000084struct chip_operations superio_ite_it8712f_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000085 CHIP_NAME("ITE IT8712F Super I/O")
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000086 .enable_dev = enable_dev,
87};