blob: a07cd99d3254766e9e99f9bf881feef81cbd10da [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>
Kyösti Mälkki3855c012019-03-03 08:45:19 +020020#include <device/pnp_ops.h>
Edward O'Callaghan536a4432015-01-04 16:41:27 +110021#include <device/pnp.h>
22#include <stdint.h>
arch import user (historical)98d0d302005-07-06 17:13:46 +000023#include "lpc47b397.h"
24
Edward O'Callaghan85836c22014-07-09 20:26:25 +100025static void pnp_enter_conf_state(pnp_devfn_t dev)
Zheng Bao9db833b2009-12-28 09:59:44 +000026{
Uwe Hermanna69d9782010-11-15 19:35:14 +000027 u16 port = dev >> 8;
Myles Watsoncee94382008-10-02 19:21:30 +000028 outb(0x55, port);
arch import user (historical)98d0d302005-07-06 17:13:46 +000029}
Myles Watsoncee94382008-10-02 19:21:30 +000030
Edward O'Callaghan85836c22014-07-09 20:26:25 +100031static void pnp_exit_conf_state(pnp_devfn_t dev)
Zheng Bao9db833b2009-12-28 09:59:44 +000032{
Uwe Hermanna69d9782010-11-15 19:35:14 +000033 u16 port = dev >> 8;
Myles Watsoncee94382008-10-02 19:21:30 +000034 outb(0xaa, port);
arch import user (historical)98d0d302005-07-06 17:13:46 +000035}
Myles Watsoncee94382008-10-02 19:21:30 +000036
Edward O'Callaghan536a4432015-01-04 16:41:27 +110037void lpc47b397_enable_serial(pnp_devfn_t dev, u16 iobase)
arch import user (historical)98d0d302005-07-06 17:13:46 +000038{
39 pnp_enter_conf_state(dev);
40 pnp_set_logical_device(dev);
41 pnp_set_enable(dev, 0);
42 pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
43 pnp_set_enable(dev, 1);
44 pnp_exit_conf_state(dev);
45}