coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
early_serial.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_ops.h>
5 #include <stdint.h>
6 #include "w83627dhg.h"
7 
9 {
10  u16 port = dev >> 8;
11  outb(0x87, port);
12  outb(0x87, port);
13 }
14 
16 {
17  u16 port = dev >> 8;
18  outb(0xaa, port);
19 }
20 
21 /**
22  * Select Pin 89, Pin 90 function as I2C interface SDA, SCL.
23  * {Pin 89, Pin 90} function can be selected as {GP33, GP32}, or
24  * {RSTOUT3#, RSTOUT2#} or {SDA, SCL}
25  */
27 {
28  u8 val;
29 
32 
33  val = pnp_read_config(dev, 0x2A);
34  val |= 1 << 1;
35  pnp_write_config(dev, 0x2A, val);
36 
38 }
39 
41 {
42  u8 reg8;
43 
45  reg8 = pnp_read_config(dev, 0x24);
46  reg8 |= (1 << 6); /* Set CLKSEL (clock input on pin 1) to 48MHz. */
47  pnp_write_config(dev, 0x24, reg8);
49 }
void outb(u8 val, u16 port)
port
Definition: i915.h:29
void pnp_set_logical_device(struct device *dev)
Definition: pnp_device.c:59
u8 pnp_read_config(struct device *dev, u8 reg)
Definition: pnp_device.c:44
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
void pnp_exit_ext_func_mode(pnp_devfn_t dev)
Definition: early_serial.c:17
void pnp_enter_ext_func_mode(pnp_devfn_t dev)
Definition: early_serial.c:11
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
u8 val
Definition: sys.c:300
void w83627dhg_set_clksel_48(pnp_devfn_t dev)
Definition: early_serial.c:40
void w83627dhg_enable_i2c(pnp_devfn_t dev)
Select Pin 89, Pin 90 function as I2C interface SDA, SCL.
Definition: early_serial.c:26