Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2010 Marc Jones <marcj303@gmail.com> |
| 5 | * Copyright (C) 2008 Corey Osgood <corey.osgood@gmail.com> |
| 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. |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 18 | #include <arch/io.h> |
| 19 | #include <device/device.h> |
| 20 | #include <device/pnp.h> |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 21 | #include <superio/conf_mode.h> |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 22 | #include <console/console.h> |
| 23 | #include <stdlib.h> |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 24 | #include "f71859.h" |
| 25 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 26 | static void f71859_init(struct device *dev) |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 27 | { |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 28 | if (!dev->enabled) |
| 29 | return; |
| 30 | |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 31 | /* TODO: Might potentially need code for HWM or FDC etc. */ |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 32 | } |
| 33 | |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 34 | static struct device_operations ops = { |
| 35 | .read_resources = pnp_read_resources, |
Nico Huber | 0b2ee93 | 2013-06-15 19:58:35 +0200 | [diff] [blame] | 36 | .set_resources = pnp_set_resources, |
| 37 | .enable_resources = pnp_enable_resources, |
| 38 | .enable = pnp_alt_enable, |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 39 | .init = f71859_init, |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 40 | .ops_pnp_mode = &pnp_conf_mode_8787_aa, |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | static struct pnp_info pnp_dev_info[] = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 44 | /* TODO: Some of the 0x07f8 etc. values may not be correct. */ |
| 45 | { &ops, F71859_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 48 | static void enable_dev(struct device *dev) |
Marc Jones | 43882f1 | 2010-09-10 22:13:34 +0000 | [diff] [blame] | 49 | { |
| 50 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 51 | } |
| 52 | |
| 53 | struct chip_operations superio_fintek_f71859_ops = { |
| 54 | CHIP_NAME("Fintek F71859 Super I/O") |
| 55 | .enable_dev = enable_dev |
| 56 | }; |