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 |
| 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 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> |
Kyösti Mälkki | 3855c01 | 2019-03-03 08:45:19 +0200 | [diff] [blame] | 20 | #include <device/pnp_ops.h> |
Edward O'Callaghan | 536a443 | 2015-01-04 16:41:27 +1100 | [diff] [blame] | 21 | #include <device/pnp.h> |
| 22 | #include <stdint.h> |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 23 | #include "lpc47b397.h" |
| 24 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 25 | static void pnp_enter_conf_state(pnp_devfn_t dev) |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 26 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 27 | u16 port = dev >> 8; |
Myles Watson | cee9438 | 2008-10-02 19:21:30 +0000 | [diff] [blame] | 28 | outb(0x55, port); |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 29 | } |
Myles Watson | cee9438 | 2008-10-02 19:21:30 +0000 | [diff] [blame] | 30 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 31 | static void pnp_exit_conf_state(pnp_devfn_t dev) |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 32 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 33 | u16 port = dev >> 8; |
Myles Watson | cee9438 | 2008-10-02 19:21:30 +0000 | [diff] [blame] | 34 | outb(0xaa, port); |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 35 | } |
Myles Watson | cee9438 | 2008-10-02 19:21:30 +0000 | [diff] [blame] | 36 | |
Edward O'Callaghan | 536a443 | 2015-01-04 16:41:27 +1100 | [diff] [blame] | 37 | void lpc47b397_enable_serial(pnp_devfn_t dev, u16 iobase) |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 38 | { |
| 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 | } |