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