blob: bde4f33bef338d92a1c235e992bf4fbda1704046 [file] [log] [blame]
Damien Zammitcbe7a8e2015-08-19 15:23:32 +10001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Damien Zammit <damien@zamaudio.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020017#include <device/pci_ops.h>
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100018#include <southbridge/intel/i82801gx/i82801gx.h>
19#include <northbridge/intel/x4x/x4x.h>
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100020#include <superio/ite/it8718f/it8718f.h>
21#include <superio/ite/common/ite.h>
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100022
23#define SERIAL_DEV PNP_DEV(0x2e, IT8718F_SP1)
24#define GPIO_DEV PNP_DEV(0x2e, IT8718F_GPIO)
25#define EC_DEV PNP_DEV(0x2e, IT8718F_EC)
26#define SUPERIO_DEV PNP_DEV(0x2e, 0)
27
28/* Early mainboard specific GPIO setup.
29 * We should use standard gpio.h eventually
30 */
31
Arthur Heymansbf53acc2019-11-11 21:14:39 +010032void mb_lpc_setup(void)
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100033{
Antonello Dettorief8021c2016-09-03 10:45:33 +020034 pci_devfn_t dev;
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100035
36 /* Southbridge GPIOs. */
37 dev = PCI_DEV(0x0, 0x1f, 0x0);
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100038 /* Set default GPIOs on superio */
39 ite_reg_write(GPIO_DEV, 0x25, 0x00);
40 ite_reg_write(GPIO_DEV, 0x26, 0xc7);
41 ite_reg_write(GPIO_DEV, 0x27, 0x80);
42 ite_reg_write(GPIO_DEV, 0x28, 0x41);
43 ite_reg_write(GPIO_DEV, 0x29, 0x0a);
44 ite_reg_write(GPIO_DEV, 0x2c, 0x01);
45 ite_reg_write(GPIO_DEV, 0x62, 0x08);
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100046 ite_reg_write(GPIO_DEV, 0x72, 0x00);
47 ite_reg_write(GPIO_DEV, 0x73, 0x00);
Damien Zammit2abd3f92016-05-21 01:56:53 +100048 ite_reg_write(GPIO_DEV, 0xb8, 0x00);
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100049 ite_reg_write(GPIO_DEV, 0xbb, 0x40);
50 ite_reg_write(GPIO_DEV, 0xc0, 0x00);
51 ite_reg_write(GPIO_DEV, 0xc1, 0xc7);
52 ite_reg_write(GPIO_DEV, 0xc2, 0x80);
53 ite_reg_write(GPIO_DEV, 0xc3, 0x01);
54 ite_reg_write(GPIO_DEV, 0xc4, 0x0a);
55 ite_reg_write(GPIO_DEV, 0xc8, 0x00);
56 ite_reg_write(GPIO_DEV, 0xc9, 0x04);
57 ite_reg_write(GPIO_DEV, 0xcb, 0x00);
58 ite_reg_write(GPIO_DEV, 0xcc, 0x02);
59 ite_reg_write(GPIO_DEV, 0xf0, 0x10);
60 ite_reg_write(GPIO_DEV, 0xf1, 0x40);
61 ite_reg_write(GPIO_DEV, 0xf6, 0x26);
62 ite_reg_write(GPIO_DEV, 0xfc, 0x52);
63
64 ite_reg_write(EC_DEV, 0xf0, 0x80);
65 ite_reg_write(EC_DEV, 0xf1, 0x00);
66 ite_reg_write(EC_DEV, 0xf2, 0x0a);
67 ite_reg_write(EC_DEV, 0xf3, 0x80);
68 ite_reg_write(EC_DEV, 0x70, 0x00); // Don't use IRQ9
Damien Zammit2abd3f92016-05-21 01:56:53 +100069 ite_reg_write(EC_DEV, 0x30, 0x01); // Enable
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100070
Arthur Heymansbf53acc2019-11-11 21:14:39 +010071 ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
72
73 /* Disable SIO reboot */
74 ite_reg_write(GPIO_DEV, 0xEF, 0x7E);
75
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100076 /* IRQ routing */
Arthur Heymansb451df22017-08-15 20:59:09 +020077 RCBA32(D31IP) = 0x00002210;
78 RCBA32(D30IP) = 0x00002100;
79 RCBA32(D29IP) = 0x10004321;
80 RCBA32(D28IP) = 0x00214321;
81 RCBA32(D27IP) = 0x00000001;
82 RCBA32(D31IR) = 0x00410032;
83 RCBA32(D29IR) = 0x32100237;
84 RCBA32(D27IR) = 0x00000000;
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100085}
86
Arthur Heymansbf53acc2019-11-11 21:14:39 +010087void mb_get_spd_map(u8 spd_map[4])
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100088{
Arthur Heymansbf53acc2019-11-11 21:14:39 +010089 spd_map[0] = 0x50;
90 spd_map[2] = 0x52;
Damien Zammitcbe7a8e2015-08-19 15:23:32 +100091}