blob: a3d03810bf39338231cf48912a6dae6525c82c0d [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
6 * Copyright (C) 2004 Tyan
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 Bao9db833b2009-12-28 09:59:44 +000017 */
18
Stefan Reinauer24d1d4b2013-03-21 11:51:41 -070019#include <arch/io.h>
Edward O'Callaghan536a4432015-01-04 16:41:27 +110020#include <device/pnp.h>
21#include <stdint.h>
arch import user (historical)98d0d302005-07-06 17:13:46 +000022#include "lpc47b397.h"
23
Edward O'Callaghan85836c22014-07-09 20:26:25 +100024static void pnp_enter_conf_state(pnp_devfn_t dev)
Zheng Bao9db833b2009-12-28 09:59:44 +000025{
Uwe Hermanna69d9782010-11-15 19:35:14 +000026 u16 port = dev >> 8;
Myles Watsoncee94382008-10-02 19:21:30 +000027 outb(0x55, port);
arch import user (historical)98d0d302005-07-06 17:13:46 +000028}
Myles Watsoncee94382008-10-02 19:21:30 +000029
Edward O'Callaghan85836c22014-07-09 20:26:25 +100030static void pnp_exit_conf_state(pnp_devfn_t dev)
Zheng Bao9db833b2009-12-28 09:59:44 +000031{
Uwe Hermanna69d9782010-11-15 19:35:14 +000032 u16 port = dev >> 8;
Myles Watsoncee94382008-10-02 19:21:30 +000033 outb(0xaa, port);
arch import user (historical)98d0d302005-07-06 17:13:46 +000034}
Myles Watsoncee94382008-10-02 19:21:30 +000035
Edward O'Callaghan536a4432015-01-04 16:41:27 +110036void lpc47b397_enable_serial(pnp_devfn_t dev, u16 iobase)
arch import user (historical)98d0d302005-07-06 17:13:46 +000037{
38 pnp_enter_conf_state(dev);
39 pnp_set_logical_device(dev);
40 pnp_set_enable(dev, 0);
41 pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
42 pnp_set_enable(dev, 1);
43 pnp_exit_conf_state(dev);
44}