Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Bin Meng | 0966130 | 2014-12-12 21:05:25 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com> |
Bin Meng | 0966130 | 2014-12-12 21:05:25 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <asm/io.h> |
| 8 | #include <asm/pnp_def.h> |
| 9 | |
| 10 | static void pnp_enter_conf_state(u16 dev) |
| 11 | { |
| 12 | u16 port = dev >> 8; |
| 13 | |
| 14 | outb(0x55, port); |
| 15 | } |
| 16 | |
| 17 | static void pnp_exit_conf_state(u16 dev) |
| 18 | { |
| 19 | u16 port = dev >> 8; |
| 20 | |
| 21 | outb(0xaa, port); |
| 22 | } |
| 23 | |
Bin Meng | df92cee | 2015-08-21 00:18:51 -0700 | [diff] [blame] | 24 | void lpc47m_enable_serial(uint dev, uint iobase, uint irq) |
Bin Meng | 0966130 | 2014-12-12 21:05:25 +0800 | [diff] [blame] | 25 | { |
| 26 | pnp_enter_conf_state(dev); |
| 27 | pnp_set_logical_device(dev); |
| 28 | pnp_set_enable(dev, 0); |
| 29 | pnp_set_iobase(dev, PNP_IDX_IO0, iobase); |
Bin Meng | 6e0150f | 2015-03-31 11:25:03 +0800 | [diff] [blame] | 30 | pnp_set_irq(dev, PNP_IDX_IRQ0, irq); |
Bin Meng | 0966130 | 2014-12-12 21:05:25 +0800 | [diff] [blame] | 31 | pnp_set_enable(dev, 1); |
| 32 | pnp_exit_conf_state(dev); |
| 33 | } |
Bin Meng | df92cee | 2015-08-21 00:18:51 -0700 | [diff] [blame] | 34 | |
| 35 | void lpc47m_enable_kbc(uint dev, uint irq0, uint irq1) |
| 36 | { |
| 37 | pnp_enter_conf_state(dev); |
| 38 | pnp_set_logical_device(dev); |
| 39 | pnp_set_enable(dev, 0); |
| 40 | pnp_set_irq(dev, PNP_IDX_IRQ0, irq0); |
| 41 | pnp_set_irq(dev, PNP_IDX_IRQ1, irq1); |
| 42 | pnp_set_enable(dev, 1); |
| 43 | pnp_exit_conf_state(dev); |
| 44 | } |