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 | */ |
| 18 | |
Stefan Reinauer | 24d1d4b | 2013-03-21 11:51:41 -0700 | [diff] [blame] | 19 | #include <arch/io.h> |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 20 | #include "w83977tf.h" |
| 21 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 22 | static void pnp_enter_ext_func_mode(pnp_devfn_t dev) |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 23 | { |
Uwe Hermann | 340fa93 | 2010-11-10 14:53:36 +0000 | [diff] [blame] | 24 | u16 port = dev >> 8; |
Roger Zauner | a846a5e | 2007-05-09 17:54:25 +0000 | [diff] [blame] | 25 | outb(0x87, port); |
| 26 | outb(0x87, port); |
| 27 | } |
| 28 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 29 | static void pnp_exit_ext_func_mode(pnp_devfn_t dev) |
Roger Zauner | a846a5e | 2007-05-09 17:54:25 +0000 | [diff] [blame] | 30 | { |
Uwe Hermann | 340fa93 | 2010-11-10 14:53:36 +0000 | [diff] [blame] | 31 | u16 port = dev >> 8; |
Roger Zauner | a846a5e | 2007-05-09 17:54:25 +0000 | [diff] [blame] | 32 | outb(0xaa, port); |
| 33 | } |
| 34 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 35 | static void w83977tf_enable_serial(pnp_devfn_t dev, u16 iobase) |
Roger Zauner | a846a5e | 2007-05-09 17:54:25 +0000 | [diff] [blame] | 36 | { |
| 37 | pnp_enter_ext_func_mode(dev); |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 38 | pnp_set_logical_device(dev); |
| 39 | pnp_set_enable(dev, 0); |
| 40 | pnp_set_iobase(dev, PNP_IDX_IO0, iobase); |
| 41 | pnp_set_enable(dev, 1); |
Roger Zauner | a846a5e | 2007-05-09 17:54:25 +0000 | [diff] [blame] | 42 | pnp_exit_ext_func_mode(dev); |
Richard Smith | 924f92f | 2006-07-29 17:40:36 +0000 | [diff] [blame] | 43 | } |