blob: 6b6e7909416ea605ec4276855691df95222d6d1f [file] [log] [blame]
Zheng Bao9db833b2009-12-28 09:59:44 +00001/*
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 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Zheng Bao9db833b2009-12-28 09:59:44 +000016 */
Ronald G. Minnich6a3a3e52003-06-30 17:23:35 +000017
Ronald G. Minnich6a3a3e52003-06-30 17:23:35 +000018#include <arch/io.h>
Eric Biederman0ac6b412003-09-02 17:16:48 +000019#include <device/device.h>
Eric Biederman5cd81732004-03-11 15:01:31 +000020#include <device/pnp.h>
Eric Biederman0ac6b412003-09-02 17:16:48 +000021#include <console/console.h>
22#include <string.h>
Eric Biederman5cd81732004-03-11 15:01:31 +000023#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000024#include <stdlib.h>
Eric Biederman5cd81732004-03-11 15:01:31 +000025#include "pc87360.h"
Ronald G. Minnich6a3a3e52003-06-30 17:23:35 +000026
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110027static void init(struct device *dev)
Ronald G. Minnich6a3a3e52003-06-30 17:23:35 +000028{
Uwe Hermanna69d9782010-11-15 19:35:14 +000029 if (!dev->enabled)
Eric Biederman5cd81732004-03-11 15:01:31 +000030 return;
Uwe Hermanna69d9782010-11-15 19:35:14 +000031
Stefan Reinauer2b34db82009-02-28 20:10:20 +000032 switch(dev->path.pnp.device) {
Eric Biederman5cd81732004-03-11 15:01:31 +000033 case PC87360_KBCK:
Edward O'Callaghandef00be2014-04-30 05:01:52 +100034 pc_keyboard_init();
Eric Biederman5cd81732004-03-11 15:01:31 +000035 break;
Eric Biederman0ac6b412003-09-02 17:16:48 +000036 }
37}
38
Eric Biederman5cd81732004-03-11 15:01:31 +000039static struct device_operations ops = {
Eric Biederman0ac6b412003-09-02 17:16:48 +000040 .read_resources = pnp_read_resources,
41 .set_resources = pnp_set_resources,
42 .enable_resources = pnp_enable_resources,
43 .enable = pnp_enable,
Eric Biederman5cd81732004-03-11 15:01:31 +000044 .init = init,
Eric Biederman0ac6b412003-09-02 17:16:48 +000045};
46
Eric Biederman5cd81732004-03-11 15:01:31 +000047static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000048 { &ops, PC87360_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
49 { &ops, PC87360_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
50 { &ops, PC87360_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
51 { &ops, PC87360_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
52 { &ops, PC87360_SWC, PNP_IO0 | PNP_IRQ0, {0xfff0, 0}, },
53 { &ops, PC87360_KBCM, PNP_IRQ0, },
54 { &ops, PC87360_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
55 { &ops, PC87360_GPIO, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
56 { &ops, PC87360_ACB, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
57 { &ops, PC87360_FSCM, PNP_IO0 | PNP_IRQ0, {0xfff8, 0}, },
58 { &ops, PC87360_WDT, PNP_IO0 | PNP_IRQ0, {0xfffc, 0}, },
Eric Biederman5cd81732004-03-11 15:01:31 +000059};
60
Eric Biederman7003ba42004-10-16 06:20:29 +000061static void enable_dev(struct device *dev)
Eric Biederman0ac6b412003-09-02 17:16:48 +000062{
Uwe Hermanna69d9782010-11-15 19:35:14 +000063 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Eric Biederman0ac6b412003-09-02 17:16:48 +000064}
65
Uwe Hermannd86417b2006-10-24 23:00:42 +000066struct chip_operations superio_nsc_pc87360_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000067 CHIP_NAME("NSC PC87360 Super I/O")
Eric Biederman7003ba42004-10-16 06:20:29 +000068 .enable_dev = enable_dev,
Ronald G. Minnich6a3a3e52003-06-30 17:23:35 +000069};