Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Tobias Diedrich | 7a95204 | 2017-12-03 10:09:28 +0100 | [diff] [blame] | 2 | |
| 3 | #ifndef DCP847SKE_SUPERIO_H |
| 4 | #define DCP847SKE_SUPERIO_H |
| 5 | |
| 6 | #include <arch/io.h> |
Felix Held | 4a0899f | 2019-10-07 19:09:43 +0200 | [diff] [blame] | 7 | #include <superio/hwm5_conf.h> |
Tobias Diedrich | 7a95204 | 2017-12-03 10:09:28 +0100 | [diff] [blame] | 8 | |
| 9 | #define NUVOTON_PORT 0x4e |
| 10 | #define HWM_PORT 0x0a30 |
| 11 | #define GPIO_PORT 0x0a80 |
| 12 | |
| 13 | #define SUPERIO_BANK(x) (0x0700 | x) |
| 14 | #define SUPERIO_INITVAL(reg, data) ((reg << 8) | (data)) |
| 15 | #define HWM_BANK(x) (0x4e00 | x) |
| 16 | #define HWM_INITVAL SUPERIO_INITVAL |
| 17 | |
| 18 | #define SUPERIO_UNLOCK do { \ |
| 19 | outb(0x87, NUVOTON_PORT); \ |
| 20 | outb(0x87, NUVOTON_PORT); \ |
| 21 | } while (0) |
| 22 | |
| 23 | #define SUPERIO_LOCK do { \ |
| 24 | outb(0xaa, NUVOTON_PORT); \ |
| 25 | } while (0) |
| 26 | |
| 27 | #define SUPERIO_WRITE(reg, data) do { \ |
| 28 | outb((reg), NUVOTON_PORT); \ |
| 29 | outb((data), NUVOTON_PORT + 1); \ |
| 30 | } while (0) |
| 31 | |
| 32 | #define SUPERIO_WRITE_INITVAL(val) SUPERIO_WRITE((val) >> 8, (val) & 0xff) |
| 33 | |
Felix Held | 4a0899f | 2019-10-07 19:09:43 +0200 | [diff] [blame] | 34 | #define HWM_WRITE_INITVAL(val) pnp_write_hwm5_index(HWM_PORT, (val) >> 8, (val) & 0xff) |
Tobias Diedrich | 7a95204 | 2017-12-03 10:09:28 +0100 | [diff] [blame] | 35 | |
| 36 | #endif /* DCP847SKE_SUPERIO_H */ |