blob: 1b15907b09331d1c40994409cfb512c8afad75b9 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Bin Meng09661302014-12-12 21:05:25 +08002/*
3 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
Bin Meng09661302014-12-12 21:05:25 +08004 */
5
Bin Meng09661302014-12-12 21:05:25 +08006#include <asm/io.h>
7#include <asm/pnp_def.h>
8
9static void pnp_enter_conf_state(u16 dev)
10{
11 u16 port = dev >> 8;
12
13 outb(0x55, port);
14}
15
16static void pnp_exit_conf_state(u16 dev)
17{
18 u16 port = dev >> 8;
19
20 outb(0xaa, port);
21}
22
Bin Mengdf92cee2015-08-21 00:18:51 -070023void lpc47m_enable_serial(uint dev, uint iobase, uint irq)
Bin Meng09661302014-12-12 21:05:25 +080024{
25 pnp_enter_conf_state(dev);
26 pnp_set_logical_device(dev);
27 pnp_set_enable(dev, 0);
28 pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
Bin Meng6e0150f2015-03-31 11:25:03 +080029 pnp_set_irq(dev, PNP_IDX_IRQ0, irq);
Bin Meng09661302014-12-12 21:05:25 +080030 pnp_set_enable(dev, 1);
31 pnp_exit_conf_state(dev);
32}
Bin Mengdf92cee2015-08-21 00:18:51 -070033
34void lpc47m_enable_kbc(uint dev, uint irq0, uint irq1)
35{
36 pnp_enter_conf_state(dev);
37 pnp_set_logical_device(dev);
38 pnp_set_enable(dev, 0);
39 pnp_set_irq(dev, PNP_IDX_IRQ0, irq0);
40 pnp_set_irq(dev, PNP_IDX_IRQ1, irq1);
41 pnp_set_enable(dev, 1);
42 pnp_exit_conf_state(dev);
43}