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. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include <console/console.h> |
| 21 | #include <device/device.h> |
| 22 | #include <device/pci.h> |
| 23 | #include <arch/io.h> |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 24 | #include <cpu/x86/msr.h> |
| 25 | #include <cpu/amd/mtrr.h> |
| 26 | #include <device/pci_def.h> |
Kerry She | feed329 | 2011-08-18 18:03:44 +0800 | [diff] [blame] | 27 | #include "SBPLATFORM.h" |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 28 | |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 29 | |
| 30 | u8 is_dev3_present(void); |
| 31 | void set_pcie_dereset(void); |
| 32 | void set_pcie_reset(void); |
| 33 | void enable_int_gfx(void); |
| 34 | |
| 35 | /* GPIO6. */ |
| 36 | void enable_int_gfx(void) |
| 37 | { |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 38 | volatile u8 *gpio_reg; |
| 39 | |
Kerry She | feed329 | 2011-08-18 18:03:44 +0800 | [diff] [blame] | 40 | #ifdef UNUSED_CODE |
| 41 | RWPMIO(SB_PMIOA_REGEA, AccWidthUint8, ~(BIT0), BIT0); /* Disable the PCIB */ |
| 42 | RWPMIO(SB_PMIOA_REGF6, AccWidthUint8, ~(BIT0), BIT0); /* Disable Gec */ |
| 43 | #endif |
| 44 | /* make sure the Acpi MMIO(fed80000) is accessible */ |
| 45 | RWPMIO(SB_PMIOA_REG24, AccWidthUint8, ~(BIT0), BIT0); |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 46 | |
Kerry She | feed329 | 2011-08-18 18:03:44 +0800 | [diff] [blame] | 47 | gpio_reg = (volatile u8 *)ACPI_MMIO_BASE + 0xD00; /* IoMux Register */ |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 48 | |
| 49 | *(gpio_reg + 0x6) = 0x1; /* Int_vga_en */ |
| 50 | *(gpio_reg + 170) = 0x1; /* gpio_gate */ |
| 51 | |
Kerry She | feed329 | 2011-08-18 18:03:44 +0800 | [diff] [blame] | 52 | gpio_reg = (volatile u8 *)ACPI_MMIO_BASE + 0x100; /* GPIO Registers */ |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 53 | |
| 54 | *(gpio_reg + 0x6) = 0x8; |
| 55 | *(gpio_reg + 170) = 0x0; |
| 56 | } |
| 57 | |
| 58 | void set_pcie_dereset() |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | void set_pcie_reset(void) |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | u8 is_dev3_present(void) |
| 67 | { |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | |
| 72 | /************************************************* |
| 73 | * enable the dedicated function in A785E-I board. |
| 74 | * This function called early than rs780_enable. |
| 75 | *************************************************/ |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame^] | 76 | static void mainboard_enable(device_t dev) |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 77 | { |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 78 | printk(BIOS_INFO, "Mainboard A785E-I Enable. dev=0x%p\n", dev); |
| 79 | |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 80 | set_pcie_dereset(); |
| 81 | enable_int_gfx(); |
| 82 | } |
| 83 | |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 84 | struct chip_operations mainboard_ops = { |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame^] | 85 | .enable_dev = mainboard_enable, |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 86 | }; |