Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008 Corey Osgood <corey.osgood@gmail.com> |
| 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. |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 17 | #include <device/device.h> |
| 18 | #include <device/pnp.h> |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 19 | #include <superio/conf_mode.h> |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 20 | #include <stdlib.h> |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 21 | #include "f71805f.h" |
| 22 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 23 | static void f71805f_init(struct device *dev) |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 24 | { |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 25 | if (!dev->enabled) |
| 26 | return; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 27 | |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 28 | /* TODO: Might potentially need code for HWM or FDC etc. */ |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 29 | } |
| 30 | |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 31 | static struct device_operations ops = { |
| 32 | .read_resources = pnp_read_resources, |
Nico Huber | 0b2ee93 | 2013-06-15 19:58:35 +0200 | [diff] [blame] | 33 | .set_resources = pnp_set_resources, |
| 34 | .enable_resources = pnp_enable_resources, |
| 35 | .enable = pnp_alt_enable, |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 36 | .init = f71805f_init, |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 37 | .ops_pnp_mode = &pnp_conf_mode_8787_aa, |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | static struct pnp_info pnp_dev_info[] = { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 41 | /* TODO: Some of the 0x07f8 etc. values may not be correct. */ |
Felix Held | 8ac8ac6 | 2018-07-06 21:43:34 +0200 | [diff] [blame] | 42 | { NULL, F71805F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 43 | { NULL, F71805F_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 44 | { NULL, F71805F_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 45 | { NULL, F71805F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, }, |
| 46 | { NULL, F71805F_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, }, |
| 47 | { NULL, F71805F_GPIO, PNP_IRQ0, }, |
| 48 | { NULL, F71805F_PME, }, |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 49 | }; |
| 50 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 51 | static void enable_dev(struct device *dev) |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 52 | { |
| 53 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
| 54 | } |
| 55 | |
| 56 | struct chip_operations superio_fintek_f71805f_ops = { |
Uwe Hermann | 7d34188 | 2010-11-05 00:07:13 +0000 | [diff] [blame] | 57 | CHIP_NAME("Fintek F71805F/FG Super I/O") |
Corey Osgood | 9d10dc4 | 2008-05-20 18:10:24 +0000 | [diff] [blame] | 58 | .enable_dev = enable_dev |
| 59 | }; |