coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
early_init.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <arch/io.h>
4 #include <device/pnp_def.h>
5 #include <device/pnp_ops.h>
6 
7 #include "it8772f.h"
8 
9 /* NOTICE: This file is deprecated, use ite/common instead */
10 
12 {
13  u16 port = dev >> 8;
14 
15  outb(0x87, port);
16  outb(0x01, port);
17  outb(0x55, port);
18  outb((port == 0x4e) ? 0xaa : 0x55, port);
19 }
20 
22 {
24 }
25 
26 /* Set AC resume to be up to the Southbridge */
28 {
29  it8772f_enter_conf(dev);
31  pnp_write_config(dev, PNP_IDX_MSC4, 0x60);
32  it8772f_exit_conf(dev);
33 }
34 
35 /* Configure a set of GPIOs */
36 void it8772f_gpio_setup(pnp_devfn_t dev, int set, u8 select, u8 polarity,
37  u8 pullup, u8 output, u8 enable)
38 {
39  set--; /* Set 1 is offset 0 */
40  it8772f_enter_conf(dev);
42  if (set < 5) {
43  pnp_write_config(dev, GPIO_REG_SELECT(set), select);
44  pnp_write_config(dev, GPIO_REG_ENABLE(set), enable);
45  pnp_write_config(dev, GPIO_REG_POLARITY(set), polarity);
46  }
47  pnp_write_config(dev, GPIO_REG_OUTPUT(set), output);
48  pnp_write_config(dev, GPIO_REG_PULLUP(set), pullup);
49  it8772f_exit_conf(dev);
50 }
51 
52 /* Configure LED GPIOs */
53 void it8772f_gpio_led(pnp_devfn_t dev,int set, u8 select, u8 polarity, u8 pullup,
54  u8 output, u8 enable, u8 led_pin_map, u8 led_freq)
55 {
56  set--; /* Set 1 is offset 0 */
57  it8772f_enter_conf(dev);
59  if (set < 5) {
62  pnp_write_config(dev, GPIO_REG_SELECT(set), select);
63  pnp_write_config(dev, GPIO_REG_ENABLE(set), enable);
64  pnp_write_config(dev, GPIO_REG_POLARITY(set), polarity);
65  }
66  pnp_write_config(dev, GPIO_REG_OUTPUT(set), output);
67  pnp_write_config(dev, GPIO_REG_PULLUP(set), pullup);
68  it8772f_exit_conf(dev);
69 }
void outb(u8 val, u16 port)
port
Definition: i915.h:29
#define IT8772F_GPIO_LED_BLINK1_PINMAP
Definition: it8772f.h:88
#define GPIO_REG_OUTPUT(x)
Definition: it8772f.h:113
#define GPIO_REG_SELECT(x)
Definition: it8772f.h:101
#define GPIO_REG_POLARITY(x)
Definition: it8772f.h:104
#define IT8772F_GPIO_LED_BLINK1_CONTROL
Definition: it8772f.h:94
#define IT8772F_CONFIG_REG_CC
Definition: it8772f.h:124
#define GPIO_REG_PULLUP(x)
Definition: it8772f.h:107
#define IT8772F_EC
Definition: it8772f.h:15
#define IT8772F_GPIO
Definition: it8772f.h:18
#define IT8772F_CONFIG_REG_LDN
Definition: it8772f.h:125
#define GPIO_REG_ENABLE(x)
Definition: it8772f.h:110
#define PNP_IDX_MSC4
Definition: pnp_def.h:18
void pnp_write_config(struct device *dev, u8 reg, u8 value)
Definition: pnp_device.c:38
u32 pnp_devfn_t
Definition: pnp_type.h:8
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
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
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