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> |
| 22 | #include <device/pci_def.h> |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 23 | |
| 24 | u8 is_dev3_present(void); |
| 25 | void set_pcie_dereset(void); |
| 26 | void set_pcie_reset(void); |
| 27 | void enable_int_gfx(void); |
| 28 | |
| 29 | /* GPIO6. */ |
| 30 | void enable_int_gfx(void) |
| 31 | { |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 32 | volatile u8 *gpio_reg; |
| 33 | |
Kerry She | feed329 | 2011-08-18 18:03:44 +0800 | [diff] [blame] | 34 | /* make sure the Acpi MMIO(fed80000) is accessible */ |
Damien Zammit | 75a3d1f | 2016-11-28 00:29:10 +1100 | [diff] [blame^] | 35 | // XXX Redo this RWPMIO(SB_PMIOA_REG24, AccWidthUint8, ~(BIT0), BIT0); |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 36 | |
Damien Zammit | 75a3d1f | 2016-11-28 00:29:10 +1100 | [diff] [blame^] | 37 | gpio_reg = (volatile u8 *)0xFED80000 + 0xD00; /* IoMux Register */ |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 38 | |
| 39 | *(gpio_reg + 0x6) = 0x1; /* Int_vga_en */ |
| 40 | *(gpio_reg + 170) = 0x1; /* gpio_gate */ |
| 41 | |
Damien Zammit | 75a3d1f | 2016-11-28 00:29:10 +1100 | [diff] [blame^] | 42 | gpio_reg = (volatile u8 *)0xFED80000 + 0x100; /* GPIO Registers */ |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 43 | |
| 44 | *(gpio_reg + 0x6) = 0x8; |
| 45 | *(gpio_reg + 170) = 0x0; |
| 46 | } |
| 47 | |
| 48 | void set_pcie_dereset() |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | void set_pcie_reset(void) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | u8 is_dev3_present(void) |
| 57 | { |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | /************************************************* |
| 63 | * enable the dedicated function in A785E-I board. |
| 64 | * This function called early than rs780_enable. |
| 65 | *************************************************/ |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 66 | static void mainboard_enable(device_t dev) |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 67 | { |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 68 | printk(BIOS_INFO, "Mainboard A785E-I Enable. dev=0x%p\n", dev); |
| 69 | |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 70 | set_pcie_dereset(); |
| 71 | enable_int_gfx(); |
| 72 | } |
| 73 | |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 74 | struct chip_operations mainboard_ops = { |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 75 | .enable_dev = mainboard_enable, |
Kerry She | 6401fdb | 2011-05-07 09:15:02 +0000 | [diff] [blame] | 76 | }; |