blob: 6e50e0fd5ee0d3d0c43a72414f29dedb1125d87a [file] [log] [blame]
Angel Pons60ec3652020-04-03 01:22:13 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Tobias Diedrich7a952042017-12-03 10:09:28 +01002
3#ifndef DCP847SKE_SUPERIO_H
4#define DCP847SKE_SUPERIO_H
5
6#include <arch/io.h>
Felix Held4a0899f2019-10-07 19:09:43 +02007#include <superio/hwm5_conf.h>
Tobias Diedrich7a952042017-12-03 10:09:28 +01008
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 Held4a0899f2019-10-07 19:09:43 +020034#define HWM_WRITE_INITVAL(val) pnp_write_hwm5_index(HWM_PORT, (val) >> 8, (val) & 0xff)
Tobias Diedrich7a952042017-12-03 10:09:28 +010035
36#endif /* DCP847SKE_SUPERIO_H */