Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2000 AG Electronics Ltd. |
| 5 | * Copyright (C) 2003-2004 Linux Networx |
Uwe Hermann | 340fa93 | 2010-11-10 14:53:36 +0000 | [diff] [blame] | 6 | * Copyright (C) 2004 Tyan |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 17 | */ |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 18 | |
| 19 | #include <arch/io.h> |
| 20 | #include <device/device.h> |
| 21 | #include <device/pnp.h> |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 22 | #include <superio/conf_mode.h> |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 23 | #include <console/console.h> |
| 24 | #include <string.h> |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 25 | #include <pc80/keyboard.h> |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 26 | #include "w83627thg.h" |
| 27 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 28 | static void w83627thg_init(struct device *dev) |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 29 | { |
Uwe Hermann | 340fa93 | 2010-11-10 14:53:36 +0000 | [diff] [blame] | 30 | |
| 31 | if (!dev->enabled) |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 32 | return; |
Uwe Hermann | 340fa93 | 2010-11-10 14:53:36 +0000 | [diff] [blame] | 33 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 34 | switch(dev->path.pnp.device) { |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 35 | case W83627THG_KBC: |
Edward O'Callaghan | def00be | 2014-04-30 05:01:52 +1000 | [diff] [blame] | 36 | pc_keyboard_init(); |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 37 | break; |
| 38 | } |
| 39 | } |
| 40 | |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +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_enable, |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 46 | .init = w83627thg_init, |
Nico Huber | 1c81128 | 2013-06-15 20:33:44 +0200 | [diff] [blame] | 47 | .ops_pnp_mode = &pnp_conf_mode_8787_aa, |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +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 | { &ops, W83627THG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, }, |
| 52 | { &ops, W83627THG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, {0x07f8, 0}, }, |
| 53 | { &ops, W83627THG_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, }, |
| 54 | { &ops, W83627THG_SP2, PNP_IO0 | PNP_IRQ0 | PNP_MSC1, {0x07f8, 0}, }, |
| 55 | { &ops, W83627THG_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1 | PNP_MSC0, {0x07ff, 0}, {0x07ff, 4}, }, |
| 56 | { &ops, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07ff, 0}, {0x07fe, 4}, }, |
| 57 | { &ops, W83627THG_GPIO2, }, |
Stefan Reinauer | de3206a | 2010-02-22 06:09:43 +0000 | [diff] [blame] | 58 | { &ops, W83627THG_GPIO3, PNP_EN | PNP_MSC0 | PNP_MSC1, }, |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 59 | { &ops, W83627THG_ACPI, PNP_IRQ0, }, |
| 60 | { &ops, W83627THG_HWM, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, }, |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 63 | static void enable_dev(struct device *dev) |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 64 | { |
Uwe Hermann | 340fa93 | 2010-11-10 14:53:36 +0000 | [diff] [blame] | 65 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Stefan Reinauer | b70d199 | 2008-10-29 04:45:28 +0000 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | struct chip_operations superio_winbond_w83627thg_ops = { |
| 69 | CHIP_NAME("Winbond W83627THG Super I/O") |
| 70 | .enable_dev = enable_dev, |
| 71 | }; |