blob: 38a13f56a7945354305b4df5028ad8cc9f5e1aa4 [file] [log] [blame]
Kyösti Mälkki7b73e8522022-11-08 04:43:41 +00001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#include <arch/io.h>
4#include <device/pnp_ops.h>
5#include <device/pnp.h>
6#include <stdint.h>
7#include "lpc47m10x.h"
8
9void pnp_enter_conf_state(pnp_devfn_t dev)
10{
11 u16 port = dev >> 8;
12 outb(0x55, port);
13}
14
15void pnp_exit_conf_state(pnp_devfn_t dev)
16{
17 u16 port = dev >> 8;
18 outb(0xaa, port);
19}
20
21/**
22 * Configure the base I/O port of the specified serial device and enable the
23 * serial device.
24 *
25 * @param dev High 8 bits = Super I/O port, low 8 bits = logical device number.
26 * @param iobase Processor I/O port address to assign to this serial device.
27 */
28void lpc47m10x_enable_serial(pnp_devfn_t dev, u16 iobase)
29{
30 pnp_enter_conf_state(dev);
31 pnp_set_logical_device(dev);
32 pnp_set_enable(dev, 0);
33 pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
34 pnp_set_enable(dev, 1);
35 pnp_exit_conf_state(dev);
36}