Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 1 | /* |
| 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älkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 17 | #include <device/pci_ops.h> |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 18 | #include <southbridge/intel/i82801gx/i82801gx.h> |
| 19 | #include <northbridge/intel/x4x/x4x.h> |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 20 | #include <superio/ite/it8718f/it8718f.h> |
| 21 | #include <superio/ite/common/ite.h> |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 22 | |
| 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 Heymans | bf53acc | 2019-11-11 21:14:39 +0100 | [diff] [blame^] | 32 | void mb_lpc_setup(void) |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 33 | { |
Antonello Dettori | ef8021c | 2016-09-03 10:45:33 +0200 | [diff] [blame] | 34 | pci_devfn_t dev; |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 35 | |
| 36 | /* Southbridge GPIOs. */ |
| 37 | dev = PCI_DEV(0x0, 0x1f, 0x0); |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 38 | /* 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 Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 46 | ite_reg_write(GPIO_DEV, 0x72, 0x00); |
| 47 | ite_reg_write(GPIO_DEV, 0x73, 0x00); |
Damien Zammit | 2abd3f9 | 2016-05-21 01:56:53 +1000 | [diff] [blame] | 48 | ite_reg_write(GPIO_DEV, 0xb8, 0x00); |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 49 | 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 Zammit | 2abd3f9 | 2016-05-21 01:56:53 +1000 | [diff] [blame] | 69 | ite_reg_write(EC_DEV, 0x30, 0x01); // Enable |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 70 | |
Arthur Heymans | bf53acc | 2019-11-11 21:14:39 +0100 | [diff] [blame^] | 71 | ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); |
| 72 | |
| 73 | /* Disable SIO reboot */ |
| 74 | ite_reg_write(GPIO_DEV, 0xEF, 0x7E); |
| 75 | |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 76 | /* IRQ routing */ |
Arthur Heymans | b451df2 | 2017-08-15 20:59:09 +0200 | [diff] [blame] | 77 | 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 Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 85 | } |
| 86 | |
Arthur Heymans | bf53acc | 2019-11-11 21:14:39 +0100 | [diff] [blame^] | 87 | void mb_get_spd_map(u8 spd_map[4]) |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 88 | { |
Arthur Heymans | bf53acc | 2019-11-11 21:14:39 +0100 | [diff] [blame^] | 89 | spd_map[0] = 0x50; |
| 90 | spd_map[2] = 0x52; |
Damien Zammit | cbe7a8e | 2015-08-19 15:23:32 +1000 | [diff] [blame] | 91 | } |