blob: 4ce41e0b74b28a43d85e29ea5aebb67df78acd1e [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
Steven Sherkd9de6c42013-04-11 08:40:57 -06002
Dave Frodinda2daef2014-06-09 12:33:24 -06003#ifndef SUPERIO_NUVOTON_NCT5104D_H
4#define SUPERIO_NUVOTON_NCT5104D_H
Steven Sherkd9de6c42013-04-11 08:40:57 -06005
Kyösti Mälkki3855c012019-03-03 08:45:19 +02006#include <device/pnp_type.h>
7
Dave Frodin29179f02014-06-12 16:28:21 -06008/* SIO global configuration */
9#define IRQ_TYPE_SEL_CR10 0x10 /* UARTA,UARTB */
10#define IRQ_TYPE_SEL_CR11 0x11 /* SMI,UARTC,UARTD,WDTO */
11#define GLOBAL_OPTION_CR26 0x26
12#define CR26_LOCK_REG (1 << 4) /* required to access CR10/CR11 */
13
Piotr Kleinschmidtb52f7c72019-09-19 16:25:56 +020014/* LDN 0x07 specific registers */
15#define NCT5104D_GPIO0_IO 0xE0
16#define NCT5104D_GPIO1_IO 0xE4
17#define NCT5104D_GPIO6_IO 0xF8
18
19/* LDN 0x0F specific registers */
20#define NCT5104D_GPIO0_PP_OD 0xE0
21#define NCT5104D_GPIO1_PP_OD 0xE1
22#define NCT5104D_GPIO6_PP_OD 0xE6
23
Steven Sherkd9de6c42013-04-11 08:40:57 -060024/* Logical Device Numbers (LDN). */
Dave Frodin0240f942014-06-05 12:01:36 -060025#define NCT5104D_FDC 0x00 /* FDC - not pinned out */
26#define NCT5104D_SP1 0x02 /* UARTA */
27#define NCT5104D_SP2 0x03 /* UARTB */
Elyes HAOUAS7774de52020-03-30 16:46:18 +020028#define NCT5104D_GPIO_PP_OD 0x0F /* GPIO Push-Pull / Open drain select */
Dave Frodin0240f942014-06-05 12:01:36 -060029#define NCT5104D_SP3 0x10 /* UARTC */
30#define NCT5104D_SP4 0x11 /* UARTD */
31#define NCT5104D_PORT80 0x14 /* PORT 80 */
Steven Sherkd9de6c42013-04-11 08:40:57 -060032
33/* Virtual Logical Device Numbers (LDN) */
34#define NCT5104D_GPIO_V 0x07 /* GPIO - 0,1,6 Interface */
Piotr Kleinschmidt79d7f6b2019-10-07 11:59:11 +020035#define NCT5104D_GPIO_WDT_V 0x08 /* GPIO/WDT Interface */
Steven Sherkd9de6c42013-04-11 08:40:57 -060036
37/* Virtual devices sharing the enables are encoded as follows:
38 VLDN = baseLDN[7:0] | [10:8] bitpos of enable in 0x30 of baseLDN
39*/
40#define NCT5104D_GPIO0 ((0 << 8) | NCT5104D_GPIO_V)
41#define NCT5104D_GPIO1 ((1 << 8) | NCT5104D_GPIO_V)
42#define NCT5104D_GPIO6 ((6 << 8) | NCT5104D_GPIO_V)
43
Piotr Kleinschmidt79d7f6b2019-10-07 11:59:11 +020044#define NCT5104D_GPIO_WDT ((0 << 8) | NCT5104D_GPIO_WDT_V)
45#define NCT5104D_GPIO_IO ((1 << 8) | NCT5104D_GPIO_WDT_V)
46
Edward O'Callaghan85836c22014-07-09 20:26:25 +100047void nct5104d_enable_uartd(pnp_devfn_t dev);
Dave Frodinda2daef2014-06-09 12:33:24 -060048
49#endif /* SUPERIO_NUVOTON_NCT5104D_H */