blob: 3cb601bac8457c07e60f9f8014b9700fc6073971 [file] [log] [blame]
Stefan Reinauer1a08f582009-10-28 16:52:48 +00001/*
Uwe Hermann2d2f0c12009-10-28 17:36:11 +00002 * This file is part of the coreboot project.
Stefan Reinauer1a08f582009-10-28 16:52:48 +00003 *
Uwe Hermann2d2f0c12009-10-28 17:36:11 +00004 * Copyright (C) 2009 coresystems GmbH
Stefan Reinauer1a08f582009-10-28 16:52:48 +00005 *
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
Paul Menzela46a7122013-02-23 18:37:27 +010017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer1a08f582009-10-28 16:52:48 +000018 */
19
Uwe Hermann2d2f0c12009-10-28 17:36:11 +000020/* RAM driver for the SMSC LPC47M15X Super I/O chip */
21
Stefan Reinauer1a08f582009-10-28 16:52:48 +000022#include <arch/io.h>
23#include <device/device.h>
24#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020025#include <superio/conf_mode.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000026#include <console/console.h>
27#include <device/smbus.h>
28#include <string.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000029#include <pc80/keyboard.h>
30#include <stdlib.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000031#include "lpc47m15x.h"
32
Zheng Bao9db833b2009-12-28 09:59:44 +000033/* Forward declarations */
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110034static void enable_dev(struct device *dev);
35static void lpc47m15x_init(struct device *dev);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000036
Stefan Reinauer1a08f582009-10-28 16:52:48 +000037struct chip_operations superio_smsc_lpc47m15x_ops = {
38 CHIP_NAME("SMSC LPC47M15x/192/997 Super I/O")
39 .enable_dev = enable_dev
40};
41
42static struct device_operations ops = {
43 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020044 .set_resources = pnp_set_resources,
45 .enable_resources = pnp_enable_resources,
46 .enable = pnp_alt_enable,
Stefan Reinauer1a08f582009-10-28 16:52:48 +000047 .init = lpc47m15x_init,
Nico Huber1c811282013-06-15 20:33:44 +020048 .ops_pnp_mode = &pnp_conf_mode_55_aa,
Stefan Reinauer1a08f582009-10-28 16:52:48 +000049};
50
51static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000052 { &ops, LPC47M15X_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
53 { &ops, LPC47M15X_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
54 { &ops, LPC47M15X_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
55 { &ops, LPC47M15X_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
56 { &ops, LPC47M15X_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, {0x07ff, 0}, {0x07ff, 4}, },
Stefan Reinauer1a08f582009-10-28 16:52:48 +000057};
58
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110059static void enable_dev(struct device *dev)
Stefan Reinauer1a08f582009-10-28 16:52:48 +000060{
Uwe Hermanna69d9782010-11-15 19:35:14 +000061 pnp_enable_devices(dev, &pnp_ops,
62 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000063}
64
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110065static void lpc47m15x_init(struct device *dev)
Stefan Reinauer1a08f582009-10-28 16:52:48 +000066{
Stefan Reinauer1a08f582009-10-28 16:52:48 +000067
68 if (!dev->enabled)
69 return;
Zheng Bao9db833b2009-12-28 09:59:44 +000070
Stefan Reinauer1a08f582009-10-28 16:52:48 +000071 switch(dev->path.pnp.device) {
Stefan Reinauer1a08f582009-10-28 16:52:48 +000072 case LPC47M15X_KBC:
Edward O'Callaghandef00be2014-04-30 05:01:52 +100073 pc_keyboard_init();
Stefan Reinauer1a08f582009-10-28 16:52:48 +000074 break;
75 }
76}