Angel Pons | 381c4eb | 2020-04-03 01:22:06 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Alexandru Gagniuc | fccfee3 | 2014-03-26 18:51:08 -0500 | [diff] [blame] | 2 | |
Alexandru Gagniuc | b4417fb | 2014-04-06 23:57:57 -0500 | [diff] [blame] | 3 | #include "ec.h" |
Alexandru Gagniuc | 1d87dac | 2014-03-28 14:48:13 -0500 | [diff] [blame] | 4 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 5 | #include <acpi/acpi.h> |
Kyösti Mälkki | b264c5c | 2020-06-10 11:13:24 +0300 | [diff] [blame] | 6 | #include <cpu/x86/smm.h> |
Alexandru Gagniuc | fccfee3 | 2014-03-26 18:51:08 -0500 | [diff] [blame] | 7 | #include <device/device.h> |
Kyösti Mälkki | 27f340e | 2021-02-15 13:18:14 +0200 | [diff] [blame] | 8 | #include <southbridge/amd/common/amd_pci_util.h> |
Alexandru Gagniuc | fccfee3 | 2014-03-26 18:51:08 -0500 | [diff] [blame] | 9 | |
Alexandru Gagniuc | 73639e2 | 2014-04-09 12:24:39 -0500 | [diff] [blame] | 10 | #include <southbridge/amd/agesa/hudson/smi.h> |
| 11 | |
Kyösti Mälkki | 27f340e | 2021-02-15 13:18:14 +0200 | [diff] [blame] | 12 | static const u8 mainboard_picr_data[0x54] = { |
| 13 | 0x1F, 0x1f, 0x1f, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x0A, 0xF1, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, |
| 14 | 0x09, 0x1F, 0x1F, 0x0B, 0x1F, 0x0B, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 15 | 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 16 | 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 17 | 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 18 | 0x1F, 0x1F, 0x1F, 0x1F |
| 19 | }; |
| 20 | static const u8 mainboard_intr_data[0x54] = { |
| 21 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, |
| 22 | 0x09, 0x1F, 0x1F, 0x10, 0x1F, 0x10, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 23 | 0x05, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 24 | 0x12, 0x11, 0x12, 0x11, 0x12, 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 25 | 0x11, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 26 | 0x10, 0x11, 0x12, 0x13 |
| 27 | }; |
| 28 | |
Alexandru Gagniuc | 0a57e99 | 2014-04-19 15:10:14 -0500 | [diff] [blame] | 29 | static void pavilion_cold_boot_init(void) |
| 30 | { |
| 31 | /* Lid SMI is only used in non-ACPI mode; leave it off in S3 resume */ |
| 32 | hudson_configure_gevent_smi(EC_LID_GEVENT, SMI_MODE_SMI, SMI_LVL_LOW); |
| 33 | /* EC is not powered off during S3 sleep */ |
| 34 | pavilion_m6_1035dx_ec_init(); |
| 35 | } |
| 36 | |
Kyösti Mälkki | 27f340e | 2021-02-15 13:18:14 +0200 | [diff] [blame] | 37 | /* PIRQ Setup */ |
| 38 | static void pirq_setup(void) |
| 39 | { |
| 40 | intr_data_ptr = mainboard_intr_data; |
| 41 | picr_data_ptr = mainboard_picr_data; |
| 42 | } |
| 43 | |
Elyes HAOUAS | 56f172d | 2018-05-04 20:41:40 +0200 | [diff] [blame] | 44 | static void mainboard_enable(struct device *dev) |
Alexandru Gagniuc | fccfee3 | 2014-03-26 18:51:08 -0500 | [diff] [blame] | 45 | { |
Kyösti Mälkki | 27f340e | 2021-02-15 13:18:14 +0200 | [diff] [blame] | 46 | pirq_setup(); |
| 47 | |
Alexandru Gagniuc | 599d668 | 2014-04-17 23:33:50 -0500 | [diff] [blame] | 48 | hudson_configure_gevent_smi(EC_SMI_GEVENT, SMI_MODE_SMI, SMI_LVL_HIGH); |
Kyösti Mälkki | b264c5c | 2020-06-10 11:13:24 +0300 | [diff] [blame] | 49 | global_smi_enable(); |
Kyösti Mälkki | 6a089e3 | 2014-06-27 13:32:59 +0300 | [diff] [blame] | 50 | |
Kyösti Mälkki | ffdb6e8 | 2017-03-04 07:48:27 +0200 | [diff] [blame] | 51 | if (!acpi_is_wakeup_s3()) |
Alexandru Gagniuc | 0a57e99 | 2014-04-19 15:10:14 -0500 | [diff] [blame] | 52 | pavilion_cold_boot_init(); |
Alexandru Gagniuc | fccfee3 | 2014-03-26 18:51:08 -0500 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | struct chip_operations mainboard_ops = { |
| 56 | .enable_dev = mainboard_enable, |
| 57 | }; |