blob: fcce3a41db57f9ea758a1404369199da4dc87268 [file] [log] [blame]
Bin Menga2927e02014-12-12 21:05:25 +08001/*
2 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <asm/io.h>
9#include <asm/pnp_def.h>
10
11static void pnp_enter_conf_state(u16 dev)
12{
13 u16 port = dev >> 8;
14
15 outb(0x55, port);
16}
17
18static void pnp_exit_conf_state(u16 dev)
19{
20 u16 port = dev >> 8;
21
22 outb(0xaa, port);
23}
24
Bin Mengc78dfb42015-08-21 00:18:51 -070025void lpc47m_enable_serial(uint dev, uint iobase, uint irq)
Bin Menga2927e02014-12-12 21:05:25 +080026{
27 pnp_enter_conf_state(dev);
28 pnp_set_logical_device(dev);
29 pnp_set_enable(dev, 0);
30 pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
Bin Meng19268832015-03-31 11:25:03 +080031 pnp_set_irq(dev, PNP_IDX_IRQ0, irq);
Bin Menga2927e02014-12-12 21:05:25 +080032 pnp_set_enable(dev, 1);
33 pnp_exit_conf_state(dev);
34}
Bin Mengc78dfb42015-08-21 00:18:51 -070035
36void lpc47m_enable_kbc(uint dev, uint irq0, uint irq1)
37{
38 pnp_enter_conf_state(dev);
39 pnp_set_logical_device(dev);
40 pnp_set_enable(dev, 0);
41 pnp_set_irq(dev, PNP_IDX_IRQ0, irq0);
42 pnp_set_irq(dev, PNP_IDX_IRQ1, irq1);
43 pnp_set_enable(dev, 1);
44 pnp_exit_conf_state(dev);
45}