Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Advanced Micro Devices, Inc. |
| 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; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <console/console.h> |
| 17 | #include <device/device.h> |
| 18 | #include <device/pci.h> |
| 19 | #include <arch/io.h> |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 20 | #include <cpu/x86/msr.h> |
| 21 | #include <cpu/amd/mtrr.h> |
Timothy Pearson | 7ad4dc5e | 2017-01-04 14:26:26 -0600 | [diff] [blame] | 22 | #include <southbridge/amd/common/amd_defs.h> |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 23 | #include <device/pci_def.h> |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 24 | |
| 25 | u8 is_dev3_present(void); |
| 26 | void set_pcie_dereset(void); |
| 27 | void set_pcie_reset(void); |
| 28 | void enable_int_gfx(void); |
| 29 | |
| 30 | /* GPIO6. */ |
| 31 | void enable_int_gfx(void) |
| 32 | { |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 33 | volatile u8 *gpio_reg; |
| 34 | |
Kerry She | feed329 | 2011-08-18 18:03:44 +0800 | [diff] [blame] | 35 | /* make sure the Acpi MMIO(fed80000) is accessible */ |
Damien Zammit | 75a3d1f | 2016-11-28 00:29:10 +1100 | [diff] [blame] | 36 | // XXX Redo this RWPMIO(SB_PMIOA_REG24, AccWidthUint8, ~(BIT0), BIT0); |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 37 | |
Timothy Pearson | 7ad4dc5e | 2017-01-04 14:26:26 -0600 | [diff] [blame] | 38 | gpio_reg = (volatile u8 *)AMD_SB_ACPI_MMIO_ADDR + 0xD00; /* IoMux Register */ |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 39 | |
| 40 | *(gpio_reg + 0x6) = 0x1; /* Int_vga_en */ |
| 41 | *(gpio_reg + 170) = 0x1; /* gpio_gate */ |
| 42 | |
Timothy Pearson | 7ad4dc5e | 2017-01-04 14:26:26 -0600 | [diff] [blame] | 43 | gpio_reg = (volatile u8 *)AMD_SB_ACPI_MMIO_ADDR + 0x100; /* GPIO Registers */ |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 44 | |
| 45 | *(gpio_reg + 0x6) = 0x8; |
| 46 | *(gpio_reg + 170) = 0x0; |
| 47 | } |
| 48 | |
| 49 | void set_pcie_dereset() |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | void set_pcie_reset(void) |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | u8 is_dev3_present(void) |
| 58 | { |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | /************************************************* |
| 64 | * enable the dedicated function in A785E-I board. |
| 65 | * This function called early than rs780_enable. |
| 66 | *************************************************/ |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 67 | static void mainboard_enable(device_t dev) |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 68 | { |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 69 | printk(BIOS_INFO, "Mainboard A785E-I Enable. dev=0x%p\n", dev); |
| 70 | |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 71 | set_pcie_dereset(); |
| 72 | enable_int_gfx(); |
| 73 | } |
| 74 | |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 75 | struct chip_operations mainboard_ops = { |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 76 | .enable_dev = mainboard_enable, |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 77 | }; |