blob: 41339c1b7bb5a5f58eff013ca7ea86070ff6acbd [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.
Stefan Reinauer1a08f582009-10-28 16:52:48 +000014 */
15
Uwe Hermann2d2f0c12009-10-28 17:36:11 +000016/* RAM driver for the SMSC LPC47M15X Super I/O chip */
17
Stefan Reinauer1a08f582009-10-28 16:52:48 +000018#include <arch/io.h>
19#include <device/device.h>
20#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020021#include <superio/conf_mode.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000022#include <console/console.h>
23#include <device/smbus.h>
24#include <string.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000025#include <pc80/keyboard.h>
26#include <stdlib.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000027#include "lpc47m15x.h"
28
Zheng Bao9db833b2009-12-28 09:59:44 +000029/* Forward declarations */
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110030static void enable_dev(struct device *dev);
31static void lpc47m15x_init(struct device *dev);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000032
Stefan Reinauer1a08f582009-10-28 16:52:48 +000033struct chip_operations superio_smsc_lpc47m15x_ops = {
34 CHIP_NAME("SMSC LPC47M15x/192/997 Super I/O")
35 .enable_dev = enable_dev
36};
37
38static struct device_operations ops = {
39 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020040 .set_resources = pnp_set_resources,
41 .enable_resources = pnp_enable_resources,
42 .enable = pnp_alt_enable,
Stefan Reinauer1a08f582009-10-28 16:52:48 +000043 .init = lpc47m15x_init,
Nico Huber1c811282013-06-15 20:33:44 +020044 .ops_pnp_mode = &pnp_conf_mode_55_aa,
Stefan Reinauer1a08f582009-10-28 16:52:48 +000045};
46
47static struct pnp_info pnp_dev_info[] = {
Felix Heldb0d868e2018-07-06 23:39:00 +020048 { NULL, LPC47M15X_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
49 { NULL, LPC47M15X_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
50 { NULL, LPC47M15X_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
51 { NULL, LPC47M15X_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
52 { NULL, LPC47M15X_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1,
53 0x07ff, 0x07ff, },
Stefan Reinauer1a08f582009-10-28 16:52:48 +000054};
55
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110056static void enable_dev(struct device *dev)
Stefan Reinauer1a08f582009-10-28 16:52:48 +000057{
Felix Heldb0d868e2018-07-06 23:39:00 +020058 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000059}
60
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110061static void lpc47m15x_init(struct device *dev)
Stefan Reinauer1a08f582009-10-28 16:52:48 +000062{
Stefan Reinauer1a08f582009-10-28 16:52:48 +000063
64 if (!dev->enabled)
65 return;
Zheng Bao9db833b2009-12-28 09:59:44 +000066
Stefan Reinauer1a08f582009-10-28 16:52:48 +000067 switch(dev->path.pnp.device) {
Stefan Reinauer1a08f582009-10-28 16:52:48 +000068 case LPC47M15X_KBC:
Timothy Pearson448e3862015-11-24 14:12:01 -060069 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000070 break;
71 }
72}