Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame^] | 1 | /* 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 | |
| 9 | void pnp_enter_conf_state(pnp_devfn_t dev) |
| 10 | { |
| 11 | u16 port = dev >> 8; |
| 12 | outb(0x55, port); |
| 13 | } |
| 14 | |
| 15 | void 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 | */ |
| 28 | void 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 | } |