Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Wang Qing Pei | 53a811e | 2010-08-22 20:02:27 +0000 | [diff] [blame] | 4 | * Copyright (C) 2007 Corey Osgood <corey@slightlyhackish.com> |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 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. |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 17 | #include <arch/io.h> |
| 18 | #include <device/device.h> |
| 19 | #include <device/pnp.h> |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 20 | #include <superio/conf_mode.h> |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 21 | #include <stdlib.h> |
Edward O'Callaghan | def00be | 2014-04-30 05:01:52 +1000 | [diff] [blame] | 22 | #include <pc80/keyboard.h> |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 23 | #include "f71863fg.h" |
| 24 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 25 | static void f71863fg_init(struct device *dev) |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 26 | { |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 27 | struct resource *res0; |
| 28 | |
| 29 | if (!dev->enabled) |
| 30 | return; |
| 31 | |
| 32 | switch(dev->path.pnp.device) { |
| 33 | /* TODO: Might potentially need code for HWM or FDC etc. */ |
Uwe Hermann | 7d34188 | 2010-11-05 00:07:13 +0000 | [diff] [blame] | 34 | case F71863FG_KBC: |
| 35 | res0 = find_resource(dev, PNP_IDX_IO0); |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 36 | pc_keyboard_init(NO_AUX_DEVICE); |
Uwe Hermann | 7d34188 | 2010-11-05 00:07:13 +0000 | [diff] [blame] | 37 | break; |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 41 | static struct device_operations ops = { |
| 42 | .read_resources = pnp_read_resources, |
Nico Huber | 0b2ee93 | 2013-06-15 19:58:35 +0200 | [diff] [blame] | 43 | .set_resources = pnp_set_resources, |
| 44 | .enable_resources = pnp_enable_resources, |
| 45 | .enable = pnp_alt_enable, |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 46 | .init = f71863fg_init, |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 47 | .ops_pnp_mode = &pnp_conf_mode_8787_aa, |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | static struct pnp_info pnp_dev_info[] = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 51 | /* TODO: Some of the 0x07f8 etc. values may not be correct. */ |
Felix Held | 8ac8ac6 | 2018-07-06 21:43:34 +0200 | [diff] [blame] | 52 | { NULL, F71863FG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 53 | { NULL, F71863FG_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 54 | { NULL, F71863FG_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 55 | { NULL, F71863FG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 56 | { NULL, F71863FG_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, }, |
| 57 | { NULL, F71863FG_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, }, |
| 58 | { NULL, F71863FG_GPIO, }, |
| 59 | { NULL, F71863FG_VID, PNP_IO0, 0x07f8, }, |
| 60 | { NULL, F71863FG_SPI, }, |
| 61 | { NULL, F71863FG_PME, }, |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 64 | static void enable_dev(struct device *dev) |
Wang Qing Pei | 42e7c32 | 2010-08-17 15:05:05 +0000 | [diff] [blame] | 65 | { |
| 66 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 67 | } |
| 68 | |
| 69 | struct chip_operations superio_fintek_f71863fg_ops = { |
| 70 | CHIP_NAME("Fintek F71863FG Super I/O") |
| 71 | .enable_dev = enable_dev |
| 72 | }; |