blob: 1f30bfe98ea5b3a5da32969e1281001fa2b71833 [file] [log] [blame]
Stefan Reinauerf00052a2010-01-17 13:51:48 +00001/*
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.
Stefan Reinauerf00052a2010-01-17 13:51:48 +000014 */
15
16#include <arch/io.h>
17#include <device/device.h>
18#include <device/pnp.h>
19#include <console/console.h>
20#include <device/smbus.h>
21#include <string.h>
Stefan Reinauerf00052a2010-01-17 13:51:48 +000022#include <assert.h>
23#include <stdlib.h>
Edward O'Callaghandef00be2014-04-30 05:01:52 +100024#include <pc80/keyboard.h>
Stefan Reinauerf00052a2010-01-17 13:51:48 +000025
Stefan Reinauerf00052a2010-01-17 13:51:48 +000026void m3885_configure_multikey(void);
27
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110028static void m3885x_init(struct device *dev)
Stefan Reinauerf00052a2010-01-17 13:51:48 +000029{
Stefan Reinauerf00052a2010-01-17 13:51:48 +000030
31 if (!dev->enabled)
32 return;
33
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000034 printk(BIOS_DEBUG, "Renesas M3885x: Initializing keyboard.\n");
Stefan Reinauerf00052a2010-01-17 13:51:48 +000035 set_kbc_ps2_mode();
Edward O'Callaghandef00be2014-04-30 05:01:52 +100036 pc_keyboard_init();
Stefan Reinauerf00052a2010-01-17 13:51:48 +000037 m3885_configure_multikey();
38}
39
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110040static void m3885x_read_resources(struct device *dev)
Stefan Reinauerf00052a2010-01-17 13:51:48 +000041{
Uwe Hermann8c023682010-11-06 23:36:49 +000042 /* Nothing, but this function avoids an error on serial console. */
Stefan Reinauerf00052a2010-01-17 13:51:48 +000043}
44
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110045static void m3885x_enable_resources(struct device *dev)
Stefan Reinauerf00052a2010-01-17 13:51:48 +000046{
Uwe Hermann8c023682010-11-06 23:36:49 +000047 /* Nothing, but this function avoids an error on serial console. */
Stefan Reinauerf00052a2010-01-17 13:51:48 +000048}
49
50static struct device_operations ops = {
51 .init = m3885x_init,
52 .read_resources = m3885x_read_resources,
53 .enable_resources = m3885x_enable_resources
54};
55
56static struct pnp_info pnp_dev_info[] = {
57 { &ops, 0, 0, { 0, 0 }, }
58};
59
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110060static void enable_dev(struct device *dev)
Stefan Reinauerf00052a2010-01-17 13:51:48 +000061{
62 pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
63}
64
65struct chip_operations superio_renesas_m3885x_ops = {
66 CHIP_NAME("Renesas M3885x Super I/O")
67 .enable_dev = enable_dev,
68};