aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/gigabyte/ga-d510ud/early_init.c
blob: 8fdf25db65602185ece59865b9dad47bb5437512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* SPDX-License-Identifier: GPL-2.0-only */

#include <bootblock_common.h>
#include <console/console.h>
#include <device/pnp_ops.h>
#include <northbridge/intel/pineview/pineview.h>
#include <southbridge/intel/i82801gx/i82801gx.h>
#include <superio/ite/common/ite.h>
#include <superio/ite/it8720f/it8720f.h>

#define SERIAL_DEV	PNP_DEV(0x2e, IT8720F_SP1)
#define GPIO_DEV	PNP_DEV(0x2e, IT8720F_GPIO)
#define EC_DEV		PNP_DEV(0x2e, IT8720F_EC)

void bootblock_mainboard_early_init(void)
{
	/* Set default GPIOs on superio */
	pnp_enter_conf_state(GPIO_DEV);

	pnp_set_logical_device(GPIO_DEV);
	pnp_write_config(GPIO_DEV, 0x25, 0x00);
	pnp_write_config(GPIO_DEV, 0x26, 0x0c);
	pnp_write_config(GPIO_DEV, 0x28, 0x41);
	pnp_write_config(GPIO_DEV, 0x2c, 0x01);
	pnp_write_config(GPIO_DEV, 0x62, 0x08);
	pnp_write_config(GPIO_DEV, 0x72, 0x00);
	pnp_write_config(GPIO_DEV, 0xb8, 0x00);
	pnp_write_config(GPIO_DEV, 0xc0, 0x00);
	pnp_write_config(GPIO_DEV, 0xc1, 0x0c);
	pnp_write_config(GPIO_DEV, 0xc3, 0x41);
	pnp_write_config(GPIO_DEV, 0xc8, 0x00);
	pnp_write_config(GPIO_DEV, 0xcb, 0x00);
	pnp_write_config(GPIO_DEV, 0xe9, 0x01);
	pnp_write_config(GPIO_DEV, 0xfc, 0xa4);

	pnp_exit_conf_state(GPIO_DEV);

	ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);

	pnp_enter_conf_state(GPIO_DEV);
	pnp_set_logical_device(GPIO_DEV);

	printk(BIOS_DEBUG, "ITE register 0xef: 0x%02x ", pnp_read_config(GPIO_DEV, 0xef));

	/* Disable SIO reboot */
	pnp_write_config(GPIO_DEV, 0xef, 0x7e);

	printk(BIOS_DEBUG, "=> 0x%02x\n", pnp_read_config(GPIO_DEV, 0xef));

	pnp_set_logical_device(EC_DEV);
	pnp_write_config(EC_DEV, 0x70, 0x00); /* Don't use IRQ9 */
	pnp_write_config(EC_DEV, 0x30, 0x01); /* Enable */

	pnp_exit_conf_state(GPIO_DEV);
}

void get_mb_spd_addrmap(u8 *spd_addrmap)
{
	spd_addrmap[0] = 0x50;
	spd_addrmap[1] = 0x51;
}