blob: 9de88e2733d6042a26b54e6f9e07e81eda55414e [file] [log] [blame]
Frank Vibrans7b904d82011-02-14 19:00:13 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
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.
Frank Vibrans7b904d82011-02-14 19:00:13 +000014 */
15
16/* RAM driver for the SMSC KBC1100 Super I/O chip */
17
Frank Vibrans7b904d82011-02-14 19:00:13 +000018#include <device/device.h>
19#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020020#include <superio/conf_mode.h>
Frank Vibrans7b904d82011-02-14 19:00:13 +000021#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +020022
Frank Vibrans7b904d82011-02-14 19:00:13 +000023#include "kbc1100.h"
24
25/* Forward declarations */
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110026static void enable_dev(struct device *dev);
27static void kbc1100_init(struct device *dev);
Frank Vibrans7b904d82011-02-14 19:00:13 +000028
Frank Vibrans7b904d82011-02-14 19:00:13 +000029struct chip_operations superio_smsc_kbc1100_ops = {
Arthur Heymans12d01032017-08-01 21:51:10 +020030 CHIP_NAME("SMSC KBC1100 Super I/O")
31 .enable_dev = enable_dev
Frank Vibrans7b904d82011-02-14 19:00:13 +000032};
33
34static struct device_operations ops = {
Arthur Heymans12d01032017-08-01 21:51:10 +020035 .read_resources = pnp_read_resources,
36 .set_resources = pnp_set_resources,
37 .enable_resources = pnp_enable_resources,
38 .enable = pnp_alt_enable,
39 .init = kbc1100_init,
40 .ops_pnp_mode = &pnp_conf_mode_55_aa,
Frank Vibrans7b904d82011-02-14 19:00:13 +000041};
42
43static struct pnp_info pnp_dev_info[] = {
Felix Heldb0d868e2018-07-06 23:39:00 +020044 { NULL, KBC1100_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1,
45 0x7ff, 0x7ff, },
Frank Vibrans7b904d82011-02-14 19:00:13 +000046};
47
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110048static void enable_dev(struct device *dev)
Frank Vibrans7b904d82011-02-14 19:00:13 +000049{
Felix Heldb0d868e2018-07-06 23:39:00 +020050 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Frank Vibrans7b904d82011-02-14 19:00:13 +000051}
52
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110053static void kbc1100_init(struct device *dev)
Frank Vibrans7b904d82011-02-14 19:00:13 +000054{
Arthur Heymans12d01032017-08-01 21:51:10 +020055 struct resource *res0, *res1;
Frank Vibrans7b904d82011-02-14 19:00:13 +000056
Arthur Heymans12d01032017-08-01 21:51:10 +020057 if (!dev->enabled)
58 return;
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070059
Arthur Heymans12d01032017-08-01 21:51:10 +020060 switch (dev->path.pnp.device) {
61 case KBC1100_KBC:
62 res0 = find_resource(dev, PNP_IDX_IO0);
63 res1 = find_resource(dev, PNP_IDX_IO1);
64 pc_keyboard_init(NO_AUX_DEVICE);
65 break;
66 }
Frank Vibrans7b904d82011-02-14 19:00:13 +000067}