blob: e1ae5036a9f5bf4b0f3419e5354d2ef5357b4ece [file] [log] [blame]
Gergely Kissc9c29262017-12-27 15:19:16 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de>
5 * Copyright (C) 2007 Philipp Degler <pdegler@rumms.uni-mannheim.de>
6 * Copyright (C) 2017 Gergely Kiss <mail.gery@gmail.com>
7 *
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.
17 */
18
19#include <device/device.h>
20#include <device/pnp.h>
21#include <pc80/keyboard.h>
22#include <arch/io.h>
23#include <stdlib.h>
24#include <superio/conf_mode.h>
25
26#include "it8623e.h"
27
28static void it8623e_init(struct device *dev)
29{
30
31 if (!dev->enabled)
32 return;
33
34 switch (dev->path.pnp.device) {
35 case IT8623E_EC:
36 break;
37 case IT8623E_KBCK:
38 pc_keyboard_init(NO_AUX_DEVICE);
39 break;
40 case IT8623E_KBCM:
41 break;
42 }
43}
44
45static struct device_operations ops = {
46 .read_resources = pnp_read_resources,
47 .set_resources = pnp_set_resources,
48 .enable_resources = pnp_enable_resources,
49 .enable = pnp_alt_enable,
50 .init = it8623e_init,
51 .ops_pnp_mode = &pnp_conf_mode_870155_aa,
52};
53
54static struct pnp_info pnp_dev_info[] = {
55 { &ops, IT8623E_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x0ff8, },
56 { &ops, IT8623E_SP1, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
57 { &ops, IT8623E_SP2, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
58 { &ops, IT8623E_PP, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_DRQ0, 0x0ff8, 0x0ff8, },
59 { &ops, IT8623E_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0ff0, 0x0ff0, },
60 { &ops, IT8623E_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0fff, 0x0fff, },
61 { &ops, IT8623E_KBCM, PNP_IRQ0, },
62 { &ops, IT8623E_GPIO, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IRQ0, 0x0fff, 0x0fe0, 0x0fff, },
63};
64
65static void enable_dev(struct device *dev)
66{
67 pnp_enable_devices(dev, &ops,
68 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
69}
70
71struct chip_operations superio_ite_it8623e_ops = {
72 CHIP_NAME("ITE IT8623E Super I/O")
73 .enable_dev = enable_dev,
74};