blob: 3ed269e6773601a963a4576580f04022f48240cc [file] [log] [blame]
Wang Qing Pei42e7c322010-08-17 15:05:05 +00001/*
2 * This file is part of the coreboot project.
3 *
Wang Qing Pei53a811e2010-08-22 20:02:27 +00004 * Copyright (C) 2007 Corey Osgood <corey@slightlyhackish.com>
Wang Qing Pei42e7c322010-08-17 15:05:05 +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; 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.
Wang Qing Pei42e7c322010-08-17 15:05:05 +000015 */
16
Wang Qing Pei42e7c322010-08-17 15:05:05 +000017#include <arch/io.h>
18#include <device/device.h>
19#include <device/pnp.h>
Nico Huber1c811282013-06-15 20:33:44 +020020#include <superio/conf_mode.h>
Wang Qing Pei42e7c322010-08-17 15:05:05 +000021#include <console/console.h>
22#include <stdlib.h>
Edward O'Callaghandef00be2014-04-30 05:01:52 +100023#include <pc80/keyboard.h>
Wang Qing Pei42e7c322010-08-17 15:05:05 +000024#include "f71863fg.h"
25
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110026static void f71863fg_init(struct device *dev)
Wang Qing Pei42e7c322010-08-17 15:05:05 +000027{
Wang Qing Pei42e7c322010-08-17 15:05:05 +000028 struct resource *res0;
29
30 if (!dev->enabled)
31 return;
32
33 switch(dev->path.pnp.device) {
34 /* TODO: Might potentially need code for HWM or FDC etc. */
Uwe Hermann7d341882010-11-05 00:07:13 +000035 case F71863FG_KBC:
36 res0 = find_resource(dev, PNP_IDX_IO0);
Timothy Pearson448e3862015-11-24 14:12:01 -060037 pc_keyboard_init(NO_AUX_DEVICE);
Uwe Hermann7d341882010-11-05 00:07:13 +000038 break;
Wang Qing Pei42e7c322010-08-17 15:05:05 +000039 }
40}
41
Wang Qing Pei42e7c322010-08-17 15:05:05 +000042static struct device_operations ops = {
43 .read_resources = pnp_read_resources,
Nico Huber0b2ee932013-06-15 19:58:35 +020044 .set_resources = pnp_set_resources,
45 .enable_resources = pnp_enable_resources,
46 .enable = pnp_alt_enable,
Wang Qing Pei42e7c322010-08-17 15:05:05 +000047 .init = f71863fg_init,
Nico Huber1c811282013-06-15 20:33:44 +020048 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
Wang Qing Pei42e7c322010-08-17 15:05:05 +000049};
50
51static struct pnp_info pnp_dev_info[] = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000052 /* TODO: Some of the 0x07f8 etc. values may not be correct. */
Samuel Holland7daac912017-06-06 22:55:01 -050053 { &ops, F71863FG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
54 { &ops, F71863FG_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
55 { &ops, F71863FG_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
56 { &ops, F71863FG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
57 { &ops, F71863FG_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
58 { &ops, F71863FG_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
Stefan Reinauer20c3d772010-11-15 21:09:57 +000059 { &ops, F71863FG_GPIO, },
Samuel Holland7daac912017-06-06 22:55:01 -050060 { &ops, F71863FG_VID, PNP_IO0, 0x07f8, },
Uwe Hermann7d341882010-11-05 00:07:13 +000061 { &ops, F71863FG_SPI, },
Wang Qing Pei42e7c322010-08-17 15:05:05 +000062 { &ops, F71863FG_PME, },
63};
64
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110065static void enable_dev(struct device *dev)
Wang Qing Pei42e7c322010-08-17 15:05:05 +000066{
67 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
68}
69
70struct chip_operations superio_fintek_f71863fg_ops = {
71 CHIP_NAME("Fintek F71863FG Super I/O")
72 .enable_dev = enable_dev
73};