blob: 4fc05625236292018c0eb6dafeeecf84117aafd5 [file] [log] [blame]
QingPei Wange169f822011-09-13 13:35:43 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de>
5 * Copyright (C) 2011 QingPei Wang <wangqingpei@gmail.com>
6 *
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.
QingPei Wange169f822011-09-13 13:35:43 +080016 */
17
18#include <device/device.h>
19#include <device/pnp.h>
QingPei Wange169f822011-09-13 13:35:43 +080020#include <pc80/keyboard.h>
21#include <stdlib.h>
QingPei Wange169f822011-09-13 13:35:43 +080022#include "it8721f.h"
23
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110024static void init(struct device *dev)
QingPei Wange169f822011-09-13 13:35:43 +080025{
QingPei Wange169f822011-09-13 13:35:43 +080026
27 if (!dev->enabled)
28 return;
29
30 switch (dev->path.pnp.device) {
31 case IT8721F_FDC: /* TODO. */
32 break;
33 case IT8721F_PP: /* TODO. */
34 break;
35 case IT8721F_EC: /* TODO. */
36 break;
37 case IT8721F_KBCK:
Edward O'Callaghandef00be2014-04-30 05:01:52 +100038 pc_keyboard_init();
QingPei Wange169f822011-09-13 13:35:43 +080039 break;
40 case IT8721F_KBCM: /* TODO. */
41 break;
42 case IT8721F_IR: /* TODO. */
43 break;
44 }
45}
46
47static struct device_operations ops = {
48 .read_resources = pnp_read_resources,
49 .set_resources = pnp_set_resources,
50 .enable_resources = pnp_enable_resources,
51 .enable = pnp_enable,
52 .init = init,
53};
54
55/* TODO: FDC, PP, EC, KBCM, IR. */
56static struct pnp_info pnp_dev_info[] = {
57 { &ops, IT8721F_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
58 { &ops, IT8721F_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
59 { &ops, IT8721F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
60};
61
62static void enable_dev(struct device *dev)
63{
Edward O'Callaghan03ad2a22014-04-21 17:34:38 +100064 pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
QingPei Wange169f822011-09-13 13:35:43 +080065}
66
67struct chip_operations superio_ite_it8721f_ops = {
68 CHIP_NAME("ITE IT8721F Super I/O")
69 .enable_dev = enable_dev,
70};