a6118b30cb3f0ffee03bdaeebdffc0722f8b6e4f
[coreboot.git] / src / superio / renesas / m3885x / superio.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2009 coresystems GmbH
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; version 2 of the License
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #include <arch/io.h>
21 #include <device/device.h>
22 #include <device/pnp.h>
23 #include <console/console.h>
24 #include <device/smbus.h>
25 #include <string.h>
26 #include <bitops.h>
27 #include <uart8250.h>
28 #include <assert.h>
29 #include <stdlib.h>
30 #include "chip.h"
31
32 void m3885_configure_multikey(void);
33
34 static void m3885x_init(device_t dev)
35 {
36         struct superio_renesas_m3885x_config *conf = dev->chip_info;
37
38         if (!dev->enabled)
39                 return;
40
41         printk(BIOS_DEBUG, "Renesas M3885x: Initializing keyboard.\n");
42         set_kbc_ps2_mode();
43         pc_keyboard_init(&conf->keyboard);
44         m3885_configure_multikey();
45 }
46
47
48 static void m3885x_read_resources(device_t dev)
49 {
50         // nothing, but this function avoids an error on serial console.
51 }
52
53 static void m3885x_enable_resources(device_t dev)
54 {
55         // nothing, but this function avoids an error on serial console.
56 }
57
58 static struct device_operations ops = {
59         .init             = m3885x_init,
60         .read_resources   = m3885x_read_resources,
61         .enable_resources = m3885x_enable_resources
62 };
63
64 static struct pnp_info pnp_dev_info[] = {
65         { &ops, 0, 0, { 0, 0 }, }
66 };
67
68 static void enable_dev(device_t dev)
69 {
70         pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
71 }
72
73 struct chip_operations superio_renesas_m3885x_ops = {
74         CHIP_NAME("Renesas M3885x Super I/O")
75         .enable_dev = enable_dev,
76 };
77
78