coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
it8772f.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef SUPERIO_ITE_IT8772F_H
4 #define SUPERIO_ITE_IT8772F_H
5 
6 /* Supported thermal mode on TMPINx */
11 };
12 
13 #define IT8772F_FDC 0x00 /* Floppy disk controller */
14 #define IT8772F_SP1 0x01 /* Com1 */
15 #define IT8772F_EC 0x04 /* Environment controller */
16 #define IT8772F_KBCK 0x05 /* Keyboard */
17 #define IT8772F_KBCM 0x06 /* Mouse */
18 #define IT8772F_GPIO 0x07 /* GPIO */
19 #define IT8772F_IR 0x0a /* Consumer IR */
20 
21 /* Environmental Controller interface */
22 #define IT8772F_CONFIGURATION 0x00
23 #define IT8772F_INTERFACE_SELECT 0x0a
24 #define IT8772F_INTERFACE_PSEUDO_EOC (1 << 7)
25 #define IT8772F_INTERFACE_SMB_ENABLE (1 << 6)
26 #define IT8772F_INTERFACE_SEL_DISABLE (0 << 4)
27 #define IT8772F_INTERFACE_SEL_SST_SLAVE (1 << 4)
28 #define IT8772F_INTERFACE_SEL_PECI (2 << 4)
29 #define IT8772F_INTERFACE_SEL_SST_HOST (3 << 4)
30 #define IT8772F_INTERFACE_CLOCK_32MHZ (0 << 3)
31 #define IT8772F_INTERFACE_CLOCK_24MHZ (1 << 3)
32 #define IT8772F_INTERFACE_SPEED_TOLERANCE (1 << 2)
33 #define IT8772F_INTERFACE_PECI_AWFCS (1 << 0)
34 #define IT8772F_FAN_TAC2_READ 0x0e
35 #define IT8772F_FAN_TAC3_READ 0x0f
36 #define IT8772F_FAN_MAIN_CTL 0x13
37 #define IT8772F_FAN_MAIN_CTL_TAC_SMART(x) (1 << ((x)-1))
38 #define IT8772F_FAN_MAIN_CTL_TAC_EN(x) (1 << ((x)+3))
39 #define IT8772F_FAN_CTL_MODE 0x14
40 #define IT8772F_FAN_CTL_ON(x) (1 << ((x)-1))
41 #define IT8772F_FAN_PWM_MIN_DUTY (1 << 3)
42 #define IT8772F_FAN_PWM_CLOCK_48MHZ (0 << 4)
43 #define IT8772F_FAN_PWM_CLOCK_24MHZ (1 << 4)
44 #define IT8772F_FAN_PWM_CLOCK_8MHZ (3 << 4)
45 #define IT8772F_FAN_PWM_CLOCK_6MHZ (4 << 4)
46 #define IT8772F_FAN_PWM_CLOCK_3MHZ (5 << 4)
47 #define IT8772F_FAN_PWM_CLOCK_1_5MHZ (6 << 4)
48 #define IT8772F_FAN_PWM_CLOCK_51KHZ (7 << 4)
49 #define IT8772F_FAN_CTL_POLARITY_LOW (0 << 7)
50 #define IT8772F_FAN_CTL_POLARITY_HIGH (1 << 7)
51 #define IT8772F_FAN_CTL2_PWM_MODE 0x16
52 #define IT8772F_FAN_CTL3_PWM_MODE 0x17
53 #define IT8772F_FAN_CTL_PWM_MODE_SOFTWARE (0 << 7)
54 #define IT8772F_FAN_CTL_PWM_MODE_AUTOMATIC (1 << 7)
55 #define IT8772F_ADC_TEMP_CHANNEL_ENABLE 0x51
56 #define IT8772F_FAN_CTL2_PWM_START 0x6b
57 #define IT8772F_FAN_CTL2_AUTO_MODE 0x6c
58 #define IT8772F_FAN_CTL3_PWM_START 0x73
59 #define IT8772F_FAN_CTL3_AUTO_MODE 0x74
60 #define IT8772F_FAN_CTL_AUTO_SMOOTHING_DIS (0 << 7)
61 #define IT8772F_FAN_CTL_AUTO_SMOOTHING_EN (1 << 7)
62 #define IT8772F_EXTEMP_STATUS 0x88
63 #define IT8772F_EXTEMP_STATUS_HOST_BUSY (1 << 0)
64 #define IT8772F_EXTEMP_ADDRESS 0x89
65 #define IT8772F_EXTEMP_WRITE_LENGTH 0x8a
66 #define IT8772F_EXTEMP_READ_LENGTH 0x8b
67 #define IT8772F_EXTEMP_COMMAND 0x8c
68 #define IT8772F_EXTEMP_WRITE_DATA_2 0x8d
69 #define IT8772F_EXTEMP_CONTROL 0x8e
70 #define IT8772F_EXTEMP_CONTROL_AUTO_32HZ (0 << 6)
71 #define IT8772F_EXTEMP_CONTROL_AUTO_16HZ (1 << 6)
72 #define IT8772F_EXTEMP_CONTROL_AUTO_8HZ (2 << 6)
73 #define IT8772F_EXTEMP_CONTROL_AUTO_4HZ (3 << 6)
74 #define IT8772F_EXTEMP_CONTROL_AUTO_START (1 << 5)
75 #define IT8772F_EXTEMP_CONTROL_AUTO_ABORT (1 << 4)
76 #define IT8772F_EXTEMP_CONTROL_AUTO_TWO_DOMAIN (1 << 3)
77 #define IT8772F_EXTEMP_CONTROL_CONTENTION (1 << 2)
78 #define IT8772F_EXTEMP_CONTROL_SST_IDLE_HIGH (1 << 1)
79 #define IT8772F_EXTEMP_CONTROL_START (1 << 0)
80 
81 /* Standard PECI GetTemp */
82 #define PECI_CLIENT_ADDRESS 0x30
83 #define PECI_GETTEMP_COMMAND 0x01
84 #define PECI_GETTEMP_WRITE_LENGTH 0x01
85 #define PECI_GETTEMP_READ_LENGTH 0x02
86 
87 /* GPIO interface */
88 #define IT8772F_GPIO_LED_BLINK1_PINMAP 0xf8
89 
90 #define SIO_GPIO_BLINK_GPIO10 0x08
91 #define SIO_GPIO_BLINK_GPIO22 0x12
92 #define SIO_GPIO_BLINK_GPIO45 0x25
93 
94 #define IT8772F_GPIO_LED_BLINK1_CONTROL 0xf9
95 
96 #define IT8772F_GPIO_BLINK_FREQUENCY_4_HZ (0<<1)
97 #define IT8772F_GPIO_BLINK_FREQUENCY_1_HZ (1<<1)
98 #define IT8772F_GPIO_BLINK_FREQUENCY_1_4_HZ (2<<1)
99 #define IT8772F_GPIO_BLINK_FREQUENCY_1_8_HZ (3<<1)
100 
101 #define GPIO_REG_SELECT(x) (0x25 + (x))
102 
103 /* GPIO Polarity Select: 1: Inverting, 0: Non-inverting */
104 #define GPIO_REG_POLARITY(x) (0xb0 + (x))
105 
106 /* GPIO Internal Pull-up: 1: Enable, 0: Disable */
107 #define GPIO_REG_PULLUP(x) (0xb8 + (x))
108 
109 /* GPIO Function Select: 1: Simple I/O, 0: Alternate function */
110 #define GPIO_REG_ENABLE(x) (0xc0 + (x))
111 
112 /* GPIO Mode: 0: input mode, 1: output mode */
113 #define GPIO_REG_OUTPUT(x) (0xc8 + (x))
114 
115 #include <device/pnp_type.h>
116 #include <stdint.h>
117 
119 void it8772f_gpio_setup(pnp_devfn_t dev, int set, u8 select, u8 polarity,
120  u8 pullup, u8 output, u8 enable);
121 
122 /* FIXME: should be static so will be removed later.. */
123 /* Global configuration registers. */
124 #define IT8772F_CONFIG_REG_CC 0x02 /* Configure Control (write-only). */
125 #define IT8772F_CONFIG_REG_LDN 0x07 /* Logical Device Number. */
126 
129 void it8772f_gpio_led(pnp_devfn_t dev, int set, u8 select, u8 polarity, u8 pullup,
130  u8 output, u8 enable, u8 led_pin_map, u8 led_freq);
131 
132 #endif /* SUPERIO_ITE_IT8772F_H */
void it8772f_gpio_setup(pnp_devfn_t dev, int set, u8 select, u8 polarity, u8 pullup, u8 output, u8 enable)
Definition: early_init.c:36
thermal_mode
Definition: it8772f.h:7
@ THERMAL_RESISTOR
Definition: it8772f.h:10
@ THERMAL_MODE_DISABLED
Definition: it8772f.h:8
@ THERMAL_DIODE
Definition: it8772f.h:9
void it8772f_ac_resume_southbridge(pnp_devfn_t dev)
Definition: early_init.c:27
void it8772f_enter_conf(pnp_devfn_t dev)
Definition: early_init.c:11
void it8772f_exit_conf(pnp_devfn_t dev)
Definition: early_init.c:21
void it8772f_gpio_led(pnp_devfn_t dev, int set, u8 select, u8 polarity, u8 pullup, u8 output, u8 enable, u8 led_pin_map, u8 led_freq)
Definition: early_init.c:53
u32 pnp_devfn_t
Definition: pnp_type.h:8
uint8_t u8
Definition: stdint.h:45