blob: 23f2c7d92e7f18cb2405f55c7f3dc4ebe1194cea [file] [log] [blame]
Jonathan A. Kollasch89647172015-07-12 11:47:56 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2000 AG Electronics Ltd.
5 * Copyright (C) 2003-2004 Linux Networx
6 * Copyright (C) 2004 Tyan
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050017 */
18
19#include <arch/io.h>
20#include <device/device.h>
21#include <device/pnp.h>
22#include <superio/conf_mode.h>
23#include <console/console.h>
24#include <device/smbus.h>
25#include <string.h>
26#include <pc80/keyboard.h>
27#include <stdlib.h>
Jonathan A. Kollasch260a01f2015-07-12 11:49:16 -050028#include "dme1737.h"
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050029
Jonathan A. Kollasch260a01f2015-07-12 11:49:16 -050030static void dme1737_init(struct device *dev)
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050031{
32
33 if (!dev->enabled)
34 return;
35
36 switch(dev->path.pnp.device) {
Jonathan A. Kollasch260a01f2015-07-12 11:49:16 -050037 case DME1737_KBC:
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050038 pc_keyboard_init();
39 break;
40 }
41}
42
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050043static struct device_operations ops = {
44 .read_resources = pnp_read_resources,
45 .set_resources = pnp_set_resources,
Jonathan A. Kollasch260a01f2015-07-12 11:49:16 -050046 .enable_resources = pnp_enable_resources,
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050047 .enable = pnp_alt_enable,
Jonathan A. Kollasch260a01f2015-07-12 11:49:16 -050048 .init = dme1737_init,
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050049 .ops_pnp_mode = &pnp_conf_mode_55_aa,
50};
51
52static struct pnp_info pnp_dev_info[] = {
Jonathan A. Kollasch260a01f2015-07-12 11:49:16 -050053 { &ops, DME1737_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
54 { &ops, DME1737_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, },
55 { &ops, DME1737_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
56 { &ops, DME1737_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
57 { &ops, DME1737_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, {0x07ff, 0}, {0x07ff, 4}, },
58 { &ops, DME1737_RT, PNP_IO0, {0x0780, 0}, },
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050059};
60
61static void enable_dev(struct device *dev)
62{
63 pnp_enable_devices(dev, &pnp_ops,
64 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
65}
66
Jonathan A. Kollasch260a01f2015-07-12 11:49:16 -050067struct chip_operations superio_smsc_dme1737_ops = {
68 CHIP_NAME("SMSC DME1737 Super I/O")
Jonathan A. Kollasch89647172015-07-12 11:47:56 -050069 .enable_dev = enable_dev,
70};