blob: b3aa8ac665616e3a60ad454627419b8e09e556e9 [file] [log] [blame]
Zheng Bao9db833b2009-12-28 09:59:44 +00001/*
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 Hermann340fa932010-11-10 14:53:36 +00006 * Copyright (C) 2004 Tyan
Zheng Bao9db833b2009-12-28 09:59:44 +00007 *
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 Bao9db833b2009-12-28 09:59:44 +000017 */
18
Stefan Reinauer24d1d4b2013-03-21 11:51:41 -070019#include <arch/io.h>
Richard Smith924f92f2006-07-29 17:40:36 +000020#include "w83977tf.h"
21
Edward O'Callaghan85836c22014-07-09 20:26:25 +100022static void pnp_enter_ext_func_mode(pnp_devfn_t dev)
Richard Smith924f92f2006-07-29 17:40:36 +000023{
Uwe Hermann340fa932010-11-10 14:53:36 +000024 u16 port = dev >> 8;
Roger Zaunera846a5e2007-05-09 17:54:25 +000025 outb(0x87, port);
26 outb(0x87, port);
27}
28
Edward O'Callaghan85836c22014-07-09 20:26:25 +100029static void pnp_exit_ext_func_mode(pnp_devfn_t dev)
Roger Zaunera846a5e2007-05-09 17:54:25 +000030{
Uwe Hermann340fa932010-11-10 14:53:36 +000031 u16 port = dev >> 8;
Roger Zaunera846a5e2007-05-09 17:54:25 +000032 outb(0xaa, port);
33}
34
Edward O'Callaghan85836c22014-07-09 20:26:25 +100035static void w83977tf_enable_serial(pnp_devfn_t dev, u16 iobase)
Roger Zaunera846a5e2007-05-09 17:54:25 +000036{
37 pnp_enter_ext_func_mode(dev);
Richard Smith924f92f2006-07-29 17:40:36 +000038 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 Zaunera846a5e2007-05-09 17:54:25 +000042 pnp_exit_ext_func_mode(dev);
Richard Smith924f92f2006-07-29 17:40:36 +000043}