Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 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> |
Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 26 | #include <uart8250.h> |
| 27 | #include <assert.h> |
| 28 | #include <stdlib.h> |
| 29 | #include "chip.h" |
| 30 | |
Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 31 | void m3885_configure_multikey(void); |
| 32 | |
| 33 | static void m3885x_init(device_t dev) |
| 34 | { |
| 35 | struct superio_renesas_m3885x_config *conf = dev->chip_info; |
| 36 | |
| 37 | if (!dev->enabled) |
| 38 | return; |
| 39 | |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 40 | printk(BIOS_DEBUG, "Renesas M3885x: Initializing keyboard.\n"); |
Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 41 | set_kbc_ps2_mode(); |
Stefan Reinauer | 740b587 | 2010-02-23 20:31:37 +0000 | [diff] [blame] | 42 | pc_keyboard_init(&conf->keyboard); |
Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 43 | m3885_configure_multikey(); |
| 44 | } |
| 45 | |
Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 46 | static void m3885x_read_resources(device_t dev) |
| 47 | { |
Uwe Hermann | 8c02368 | 2010-11-06 23:36:49 +0000 | [diff] [blame] | 48 | /* Nothing, but this function avoids an error on serial console. */ |
Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | static void m3885x_enable_resources(device_t dev) |
| 52 | { |
Uwe Hermann | 8c02368 | 2010-11-06 23:36:49 +0000 | [diff] [blame] | 53 | /* Nothing, but this function avoids an error on serial console. */ |
Stefan Reinauer | f00052a | 2010-01-17 13:51:48 +0000 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | static struct device_operations ops = { |
| 57 | .init = m3885x_init, |
| 58 | .read_resources = m3885x_read_resources, |
| 59 | .enable_resources = m3885x_enable_resources |
| 60 | }; |
| 61 | |
| 62 | static struct pnp_info pnp_dev_info[] = { |
| 63 | { &ops, 0, 0, { 0, 0 }, } |
| 64 | }; |
| 65 | |
| 66 | static void enable_dev(device_t dev) |
| 67 | { |
| 68 | pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 69 | } |
| 70 | |
| 71 | struct chip_operations superio_renesas_m3885x_ops = { |
| 72 | CHIP_NAME("Renesas M3885x Super I/O") |
| 73 | .enable_dev = enable_dev, |
| 74 | }; |