Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2009 University of Heidelberg |
Uwe Hermann | fff87d3 | 2009-06-01 01:38:29 +0000 | [diff] [blame] | 5 | * Written by Mondrian Nuessle <nuessle@uni-heidelberg.de> for Univ. Heidelberg |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
Uwe Hermann | fff87d3 | 2009-06-01 01:38:29 +0000 | [diff] [blame] | 18 | /* PILOT Super I/O is only based on LPC observation done on factory system. */ |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 19 | |
Stefan Reinauer | 24d1d4b | 2013-03-21 11:51:41 -0700 | [diff] [blame] | 20 | #include <arch/io.h> |
Edward O'Callaghan | f18abab | 2014-03-31 21:53:32 +1100 | [diff] [blame] | 21 | #include <device/pnp.h> |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 22 | #include "pilot.h" |
| 23 | |
Uwe Hermann | fff87d3 | 2009-06-01 01:38:29 +0000 | [diff] [blame] | 24 | /* Pilot uses 0x5A/0xA5 pattern to actiavte deactivate config access. */ |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 25 | void pnp_enter_ext_func_mode(pnp_devfn_t dev) |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 26 | { |
Uwe Hermann | 8c02368 | 2010-11-06 23:36:49 +0000 | [diff] [blame] | 27 | u16 port = dev >> 8; |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 28 | outb(0x5A, port); |
| 29 | } |
| 30 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 31 | void pnp_exit_ext_func_mode(pnp_devfn_t dev) |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 32 | { |
Uwe Hermann | 8c02368 | 2010-11-06 23:36:49 +0000 | [diff] [blame] | 33 | u16 port = dev >> 8; |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 34 | outb(0xA5, port); |
| 35 | } |
| 36 | |
Uwe Hermann | fff87d3 | 2009-06-01 01:38:29 +0000 | [diff] [blame] | 37 | /* Serial config is a fairly standard procedure. */ |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 38 | void pilot_enable_serial(pnp_devfn_t dev, u16 iobase) |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 39 | { |
| 40 | pnp_enter_ext_func_mode(dev); |
| 41 | pnp_set_logical_device(dev); |
| 42 | pnp_set_iobase(dev, PNP_IDX_IO0, iobase); |
| 43 | pnp_set_enable(dev, 1); |
| 44 | pnp_exit_ext_func_mode(dev); |
| 45 | } |
| 46 | |
Edward O'Callaghan | 85836c2 | 2014-07-09 20:26:25 +1000 | [diff] [blame] | 47 | void pilot_disable_serial(pnp_devfn_t dev) |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 48 | { |
| 49 | pnp_enter_ext_func_mode(dev); |
| 50 | pnp_set_logical_device(dev); |
Uwe Hermann | 8c02368 | 2010-11-06 23:36:49 +0000 | [diff] [blame] | 51 | pnp_set_iobase(dev, PNP_IDX_IO0, 0x0000); |
Mondrian nuessle | 21da019 | 2009-04-22 20:30:42 +0000 | [diff] [blame] | 52 | pnp_set_enable(dev, 0); |
| 53 | pnp_exit_ext_func_mode(dev); |
| 54 | } |