blob: 6f096b09aa50adca82518d67f62e74069d02b2ac [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>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000021#include <stdlib.h>
Edward O'Callaghan0f7ec312014-11-01 12:11:58 +110022#include <superio/conf_mode.h>
23
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000024#include "it8712f.h"
25
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110026static void it8712f_init(struct device *dev)
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000027{
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000028
Uwe Hermann5c6bae22010-11-08 15:16:30 +000029 if (!dev->enabled)
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000030 return;
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000031
Stefan Reinauer2b34db82009-02-28 20:10:20 +000032 switch (dev->path.pnp.device) {
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000033 case IT8712F_FDC: /* TODO. */
34 break;
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000035 case IT8712F_PP: /* TODO. */
36 break;
37 case IT8712F_EC: /* TODO. */
38 break;
39 case IT8712F_KBCK:
Marc Jonesecd176f2008-09-26 19:15:38 +000040 set_kbc_ps2_mode();
Timothy Pearson448e3862015-11-24 14:12:01 -060041 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000042 break;
43 case IT8712F_KBCM: /* TODO. */
44 break;
45 case IT8712F_MIDI: /* TODO. */
46 break;
47 case IT8712F_GAME: /* TODO. */
48 break;
49 case IT8712F_IR: /* TODO. */
50 break;
51 }
52}
53
54static struct device_operations ops = {
Nico Huber9cb09412013-06-15 15:30:19 +020055 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020056 .set_resources = pnp_set_resources,
57 .enable_resources = pnp_enable_resources,
58 .enable = pnp_alt_enable,
Nico Huber9cb09412013-06-15 15:30:19 +020059 .init = it8712f_init,
Edward O'Callaghan0f7ec312014-11-01 12:11:58 +110060 .ops_pnp_mode = &pnp_conf_mode_870155_aa,
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000061};
62
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000063static struct pnp_info pnp_dev_info[] = {
Felix Heldc40275b2017-12-27 22:11:30 +010064 { NULL, IT8712F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x0ff8, },
65 { NULL, IT8712F_SP1, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
66 { NULL, IT8712F_SP2, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
67 { NULL, IT8712F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x0ffc, },
68 { NULL, IT8712F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0ff8, 0x0ff8, },
69 { NULL, IT8712F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0fff, 0x0fff, },
70 { NULL, IT8712F_KBCM, PNP_IRQ0, },
71 { NULL, IT8712F_GPIO, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IRQ0,
72 0x0fff, 0x0ff8, 0x0ff8, },
73 { NULL, IT8712F_MIDI, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
74 { NULL, IT8712F_GAME, PNP_IO0, 0x0fff, },
75 { NULL, IT8712F_IR, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000076};
77
78static void enable_dev(struct device *dev)
79{
Felix Heldc40275b2017-12-27 22:11:30 +010080 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000081}
82
Uwe Hermannf28674e2006-11-01 12:52:49 +000083struct chip_operations superio_ite_it8712f_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000084 CHIP_NAME("ITE IT8712F Super I/O")
Stefan Reinauer6af77ae2006-08-25 19:29:57 +000085 .enable_dev = enable_dev,
86};