blob: 3f034057c0afa9ab96de49b0f8492a840721108b [file] [log] [blame]
Stefan Reinauer61be08b2006-08-29 17:41:14 +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 Reinauer61be08b2006-08-29 17:41:14 +00004 * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Stefan Reinauer61be08b2006-08-29 17:41:14 +000015 */
16
Jon Dufresne39b13f42006-12-01 09:41:11 +000017#include <device/device.h>
18#include <device/pnp.h>
Stefan Reinauer61be08b2006-08-29 17:41:14 +000019#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000020#include <stdlib.h>
Stefan Reinauer61be08b2006-08-29 17:41:14 +000021#include "it8718f.h"
22
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110023static void init(struct device *dev)
Stefan Reinauer61be08b2006-08-29 17:41:14 +000024{
Stefan Reinauer61be08b2006-08-29 17:41:14 +000025
Uwe Hermann5c6bae22010-11-08 15:16:30 +000026 if (!dev->enabled)
Stefan Reinauer61be08b2006-08-29 17:41:14 +000027 return;
Stefan Reinauer61be08b2006-08-29 17:41:14 +000028
Stefan Reinauer2b34db82009-02-28 20:10:20 +000029 switch (dev->path.pnp.device) {
Stefan Reinauer61be08b2006-08-29 17:41:14 +000030 case IT8718F_FDC: /* TODO. */
31 break;
Stefan Reinauer61be08b2006-08-29 17:41:14 +000032 case IT8718F_PP: /* TODO. */
33 break;
34 case IT8718F_EC: /* TODO. */
35 break;
36 case IT8718F_KBCK:
Edward O'Callaghandef00be2014-04-30 05:01:52 +100037 pc_keyboard_init();
Stefan Reinauer61be08b2006-08-29 17:41:14 +000038 break;
39 case IT8718F_KBCM: /* TODO. */
40 break;
41 case IT8718F_IR: /* TODO. */
42 break;
43 }
44}
45
46static struct device_operations ops = {
47 .read_resources = pnp_read_resources,
48 .set_resources = pnp_set_resources,
49 .enable_resources = pnp_enable_resources,
50 .enable = pnp_enable,
51 .init = init,
52};
53
Damien Zammit9074cec2015-12-28 23:34:00 +110054/* TODO: IR. */
Stefan Reinauer61be08b2006-08-29 17:41:14 +000055static struct pnp_info pnp_dev_info[] = {
Damien Zammit9074cec2015-12-28 23:34:00 +110056 { &ops, IT8718F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0
57 | PNP_MSC0 | PNP_MSC1, {0x0ff8, 0}, },
Uwe Hermanna69d9782010-11-15 19:35:14 +000058 { &ops, IT8718F_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
Damien Zammit9074cec2015-12-28 23:34:00 +110059 { &ops, IT8718F_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
60 { &ops, IT8718F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0
61 | PNP_MSC0 | PNP_MSC1 | PNP_MSC2 | PNP_MSC3
62 | PNP_MSC4 | PNP_MSC5 | PNP_MSC6,
63 {0x0ff8, 0}, {0x0ff8, 4}, },
64 { &ops, IT8718F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0
65 | PNP_MSC0, {0x07f8, 0}, {0x07f8, 4}, },
66 { &ops, IT8718F_KBCM, PNP_IRQ0 | PNP_MSC0, },
67 { &ops, IT8718F_PP, PNP_IO0 | PNP_IO1 | PNP_IRQ0
68 | PNP_DRQ0 | PNP_MSC0, {0x0ff8, 0}, {0x0ff8, 4}, },
Stefan Reinauer61be08b2006-08-29 17:41:14 +000069};
70
71static void enable_dev(struct device *dev)
72{
73 pnp_enable_devices(dev, &pnp_ops,
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000074 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauer61be08b2006-08-29 17:41:14 +000075}
76
Uwe Hermannf28674e2006-11-01 12:52:49 +000077struct chip_operations superio_ite_it8718f_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000078 CHIP_NAME("ITE IT8718F Super I/O")
Stefan Reinauer61be08b2006-08-29 17:41:14 +000079 .enable_dev = enable_dev,
80};