blob: 14f9ec0548df1ad38547270cebf8a96d6c2ac0a2 [file] [log] [blame]
Kerry She6401fdb2011-05-07 09:15:02 +00001/*
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 She6401fdb2011-05-07 09:15:02 +000014 */
15
16#include <console/console.h>
17#include <device/device.h>
18#include <device/pci.h>
19#include <arch/io.h>
Kerry She6401fdb2011-05-07 09:15:02 +000020#include <cpu/x86/msr.h>
21#include <cpu/amd/mtrr.h>
22#include <device/pci_def.h>
Kerry She6401fdb2011-05-07 09:15:02 +000023
24u8 is_dev3_present(void);
25void set_pcie_dereset(void);
26void set_pcie_reset(void);
27void enable_int_gfx(void);
28
29/* GPIO6. */
30void enable_int_gfx(void)
31{
Kerry She6401fdb2011-05-07 09:15:02 +000032 volatile u8 *gpio_reg;
33
Kerry Shefeed3292011-08-18 18:03:44 +080034 /* make sure the Acpi MMIO(fed80000) is accessible */
Damien Zammit75a3d1f2016-11-28 00:29:10 +110035 // XXX Redo this RWPMIO(SB_PMIOA_REG24, AccWidthUint8, ~(BIT0), BIT0);
Kerry She6401fdb2011-05-07 09:15:02 +000036
Damien Zammit75a3d1f2016-11-28 00:29:10 +110037 gpio_reg = (volatile u8 *)0xFED80000 + 0xD00; /* IoMux Register */
Kerry She6401fdb2011-05-07 09:15:02 +000038
39 *(gpio_reg + 0x6) = 0x1; /* Int_vga_en */
40 *(gpio_reg + 170) = 0x1; /* gpio_gate */
41
Damien Zammit75a3d1f2016-11-28 00:29:10 +110042 gpio_reg = (volatile u8 *)0xFED80000 + 0x100; /* GPIO Registers */
Kerry She6401fdb2011-05-07 09:15:02 +000043
44 *(gpio_reg + 0x6) = 0x8;
45 *(gpio_reg + 170) = 0x0;
46}
47
48void set_pcie_dereset()
49{
50}
51
52void set_pcie_reset(void)
53{
54}
55
56u8 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 Menzel528640d2013-02-23 21:31:23 +010066static void mainboard_enable(device_t dev)
Kerry She6401fdb2011-05-07 09:15:02 +000067{
Kerry She6401fdb2011-05-07 09:15:02 +000068 printk(BIOS_INFO, "Mainboard A785E-I Enable. dev=0x%p\n", dev);
69
Kerry She6401fdb2011-05-07 09:15:02 +000070 set_pcie_dereset();
71 enable_int_gfx();
72}
73
Kerry She6401fdb2011-05-07 09:15:02 +000074struct chip_operations mainboard_ops = {
Paul Menzel528640d2013-02-23 21:31:23 +010075 .enable_dev = mainboard_enable,
Kerry She6401fdb2011-05-07 09:15:02 +000076};