Felix Held | 3f3eca9 | 2020-01-23 17:12:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 2 | |
efdesign98 | 00c8c4a | 2011-07-20 12:37:58 -0600 | [diff] [blame] | 3 | #include <arch/io.h> |
Kyösti Mälkki | 3855c01 | 2019-03-03 08:45:19 +0200 | [diff] [blame] | 4 | #include <device/pnp_ops.h> |
efdesign98 | 00c8c4a | 2011-07-20 12:37:58 -0600 | [diff] [blame] | 5 | #include <device/pnp_def.h> |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 6 | #include "wpcm450.h" |
| 7 | |
| 8 | static void wpcm450_pnp_set_logical_device(u8 dev, u16 port) |
| 9 | { |
| 10 | outb(0x7, port); |
| 11 | outb(dev, port+1); |
| 12 | } |
| 13 | |
| 14 | static void wpcm450_pnp_set_enable(u8 dev, u16 port, u8 enable) |
| 15 | { |
| 16 | outb(0x30, port); |
| 17 | outb(enable, port+1); |
| 18 | } |
| 19 | |
| 20 | static void wpcm450_pnp_set_iobase(u8 dev, u16 port, u8 index, u16 iobase) |
| 21 | { |
| 22 | outb(index, port); |
| 23 | outb((iobase>>8)&0xFF, port+1); |
| 24 | outb(index+1, port); |
| 25 | outb(iobase&0xFF, port+1); |
| 26 | } |
| 27 | |
efdesign98 | 00c8c4a | 2011-07-20 12:37:58 -0600 | [diff] [blame] | 28 | void wpcm450_enable_dev(u8 dev, u16 port, u16 iobase) |
Zheng Bao | 8a28188 | 2011-03-27 16:33:09 +0000 | [diff] [blame] | 29 | { |
| 30 | wpcm450_pnp_set_logical_device(dev, port); |
| 31 | wpcm450_pnp_set_enable(dev, port, 0); |
| 32 | if (iobase) |
| 33 | wpcm450_pnp_set_iobase(dev, port, PNP_IDX_IO0, iobase); |
| 34 | wpcm450_pnp_set_enable(dev, port, 1); |
| 35 | } |