Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 1 | /* |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2005 Digital Design Corporation |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
Paul Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 19 | */ |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 20 | |
Stefan Reinauer | 24d1d4b | 2013-03-21 11:51:41 -0700 | [diff] [blame] | 21 | #include <arch/io.h> |
Edward O'Callaghan | c3e77fc | 2015-01-04 16:24:14 +1100 | [diff] [blame] | 22 | #include <device/pnp.h> |
| 23 | #include <stdint.h> |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 24 | #include "lpc47m10x.h" |
| 25 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 26 | static void pnp_enter_conf_state(pnp_devfn_t dev) |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 27 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 28 | u16 port = dev >> 8; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 29 | outb(0x55, port); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 30 | } |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 31 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 32 | static void pnp_exit_conf_state(pnp_devfn_t dev) |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 33 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 34 | u16 port = dev >> 8; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 35 | outb(0xaa, port); |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 38 | /** |
| 39 | * Configure the base I/O port of the specified serial device and enable the |
| 40 | * serial device. |
| 41 | * |
| 42 | * @param dev High 8 bits = Super I/O port, low 8 bits = logical device number. |
| 43 | * @param iobase Processor I/O port address to assign to this serial device. |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 44 | */ |
Edward O'Callaghan | c3e77fc | 2015-01-04 16:24:14 +1100 | [diff] [blame] | 45 | void lpc47m10x_enable_serial(pnp_devfn_t dev, u16 iobase) |
Ronald G. Minnich | 8a02b7d | 2006-08-17 20:31:09 +0000 | [diff] [blame] | 46 | { |
| 47 | pnp_enter_conf_state(dev); |
| 48 | pnp_set_logical_device(dev); |
| 49 | pnp_set_enable(dev, 0); |
| 50 | pnp_set_iobase(dev, PNP_IDX_IO0, iobase); |
| 51 | pnp_set_enable(dev, 1); |
| 52 | pnp_exit_conf_state(dev); |
| 53 | } |