Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +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. |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 15 | */ |
Steven J. Magnani | e91619a | 2005-09-12 18:55:23 +0000 | [diff] [blame] | 16 | |
Uwe Hermann | d82baa1 | 2006-12-05 14:13:10 +0000 | [diff] [blame] | 17 | /* Pre-RAM driver for SMSC LPC47B272 Super I/O chip. */ |
| 18 | |
Stefan Reinauer | 24d1d4b | 2013-03-21 11:51:41 -0700 | [diff] [blame] | 19 | #include <arch/io.h> |
Edward O'Callaghan | 117849e | 2015-01-04 16:34:03 +1100 | [diff] [blame] | 20 | #include <device/pnp.h> |
| 21 | #include <stdint.h> |
Steven J. Magnani | e91619a | 2005-09-12 18:55:23 +0000 | [diff] [blame] | 22 | #include "lpc47b272.h" |
| 23 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 24 | static void pnp_enter_conf_state(pnp_devfn_t dev) |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 25 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 26 | u16 port = dev >> 8; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 27 | outb(0x55, port); |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 28 | } |
Steven J. Magnani | e91619a | 2005-09-12 18:55:23 +0000 | [diff] [blame] | 29 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 30 | static void pnp_exit_conf_state(pnp_devfn_t dev) |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 31 | { |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 32 | u16 port = dev >> 8; |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 33 | outb(0xaa, port); |
Steven J. Magnani | e91619a | 2005-09-12 18:55:23 +0000 | [diff] [blame] | 34 | } |
| 35 | |
Uwe Hermann | b69cb5a | 2010-10-26 22:46:43 +0000 | [diff] [blame] | 36 | /** |
| 37 | * Configure the base I/O port of the specified serial device and enable the |
| 38 | * serial device. |
| 39 | * |
| 40 | * @param dev High 8 bits = Super I/O port, low 8 bits = logical device number. |
| 41 | * @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] | 42 | */ |
Edward O'Callaghan | 117849e | 2015-01-04 16:34:03 +1100 | [diff] [blame] | 43 | void lpc47b272_enable_serial(pnp_devfn_t dev, u16 iobase) |
Steven J. Magnani | e91619a | 2005-09-12 18:55:23 +0000 | [diff] [blame] | 44 | { |
| 45 | pnp_enter_conf_state(dev); |
| 46 | pnp_set_logical_device(dev); |
| 47 | pnp_set_enable(dev, 0); |
| 48 | pnp_set_iobase(dev, PNP_IDX_IO0, iobase); |
| 49 | pnp_set_enable(dev, 1); |
| 50 | pnp_exit_conf_state(dev); |
| 51 | } |