blob: ecda1e7f2a56b677c63cde017e44bb8d133b008a [file] [log] [blame]
Uwe Hermann3a662632007-03-31 19:45:24 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Uwe Hermann3a662632007-03-31 19:45:24 +00003 *
4 * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Uwe Hermann3a662632007-03-31 19:45:24 +000015 */
16
17#include <arch/io.h>
18#include <device/device.h>
19#include <device/pnp.h>
Uwe Hermann3a662632007-03-31 19:45:24 +000020#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000021#include <stdlib.h>
Uwe Hermann3a662632007-03-31 19:45:24 +000022#include "pc87309.h"
23
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110024static void init(struct device *dev)
Uwe Hermann3a662632007-03-31 19:45:24 +000025{
Uwe Hermann3a662632007-03-31 19:45:24 +000026
Uwe Hermanna69d9782010-11-15 19:35:14 +000027 if (!dev->enabled)
Uwe Hermann3a662632007-03-31 19:45:24 +000028 return;
Uwe Hermanna69d9782010-11-15 19:35:14 +000029
Stefan Reinauer2b34db82009-02-28 20:10:20 +000030 switch (dev->path.pnp.device) {
Uwe Hermann3a662632007-03-31 19:45:24 +000031 case PC87309_KBCK:
Edward O'Callaghandef00be2014-04-30 05:01:52 +100032 pc_keyboard_init();
Uwe Hermann3a662632007-03-31 19:45:24 +000033 break;
34 }
35}
36
37static struct device_operations ops = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000038 .read_resources = pnp_read_resources,
39 .set_resources = pnp_set_resources,
Uwe Hermann3a662632007-03-31 19:45:24 +000040 .enable_resources = pnp_enable_resources,
Uwe Hermanna69d9782010-11-15 19:35:14 +000041 .enable = pnp_enable,
42 .init = init,
Uwe Hermann3a662632007-03-31 19:45:24 +000043};
44
45static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000046 { &ops, PC87309_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07fa, 0}, },
47 { &ops, PC87309_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x04f8, 0}, },
48 { &ops, PC87309_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
49 { &ops, PC87309_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
Zheng Bao9db833b2009-12-28 09:59:44 +000050 /* TODO: PM. */
Uwe Hermanna69d9782010-11-15 19:35:14 +000051 { &ops, PC87309_KBCM, PNP_IRQ0, },
52 { &ops, PC87309_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x7f8, 4}, },
Uwe Hermann3a662632007-03-31 19:45:24 +000053};
54
55static void enable_dev(struct device *dev)
56{
57 pnp_enable_devices(dev, &pnp_ops,
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000058 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Uwe Hermann3a662632007-03-31 19:45:24 +000059}
60
61struct chip_operations superio_nsc_pc87309_ops = {
62 CHIP_NAME("NSC PC87309 Super I/O")
63 .enable_dev = enable_dev,
64};