Kerry Sheh | b799351 | 2011-11-15 21:27:07 +0800 | [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> |
| 24 | #include <boot/tables.h> |
| 25 | #include <cpu/x86/msr.h> |
| 26 | #include <cpu/amd/mtrr.h> |
| 27 | #include <device/pci_def.h> |
| 28 | #include "SBPLATFORM.h" /* Platfrom Specific Definitions */ |
| 29 | #include "chip.h" |
| 30 | |
Kerry Sheh | b799351 | 2011-11-15 21:27:07 +0800 | [diff] [blame] | 31 | |
| 32 | void set_pcie_reset(void); |
| 33 | void set_pcie_dereset(void); |
| 34 | |
| 35 | /** |
| 36 | * TODO |
| 37 | * SB CIMx callback |
| 38 | */ |
| 39 | void set_pcie_reset(void) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * TODO |
| 45 | * mainboard specific SB CIMx callback |
| 46 | */ |
| 47 | void set_pcie_dereset(void) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Southstation using SB GPIO 17/18 to control the Red/Green LED |
| 53 | * These two LEDs can be used to show the OS booting status. |
| 54 | */ |
| 55 | static void southstation_led_init(void) |
| 56 | { |
| 57 | #define GPIO_FUNCTION 2 //GPIO function |
| 58 | #define SB_GPIO_REG17 17 //Red Light |
| 59 | #define SB_GPIO_REG18 18 //Green Light |
| 60 | |
| 61 | /* multi-function pins switch to GPIO0-35 */ |
| 62 | RWMEM(ACPI_MMIO_BASE + PMIO_BASE + SB_PMIOA_REGEA, AccWidthUint8, ~BIT0, 1); |
| 63 | |
| 64 | /* select IOMux to function2, corresponds to GPIO */ |
| 65 | RWMEM(ACPI_MMIO_BASE + IOMUX_BASE + SB_GPIO_REG17, AccWidthUint8, ~(BIT0 | BIT1), GPIO_FUNCTION); |
| 66 | RWMEM(ACPI_MMIO_BASE + IOMUX_BASE + SB_GPIO_REG18, AccWidthUint8, ~(BIT0 | BIT1), GPIO_FUNCTION); |
| 67 | |
| 68 | /* Lighting test */ |
| 69 | RWMEM(ACPI_MMIO_BASE + GPIO_BASE + SB_GPIO_REG17, AccWidthUint8, ~(0xFF), 0x08); //output high |
| 70 | RWMEM(ACPI_MMIO_BASE + GPIO_BASE + SB_GPIO_REG18, AccWidthUint8, ~(0xFF), 0x08); |
| 71 | mdelay(100); |
| 72 | RWMEM(ACPI_MMIO_BASE + GPIO_BASE + SB_GPIO_REG17, AccWidthUint8, ~(0xFF), 0x48); //output low |
| 73 | RWMEM(ACPI_MMIO_BASE + GPIO_BASE + SB_GPIO_REG18, AccWidthUint8, ~(0xFF), 0x48); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | /************************************************* |
| 78 | * enable the dedicated function in southstation board. |
| 79 | *************************************************/ |
| 80 | static void southstation_enable(device_t dev) |
| 81 | { |
| 82 | printk(BIOS_INFO, "Mainboard " CONFIG_MAINBOARD_PART_NUMBER " Enable.\n"); |
Kyösti Mälkki | 55fff930 | 2012-07-11 08:02:39 +0300 | [diff] [blame] | 83 | setup_uma_memory(); |
Kerry Sheh | b799351 | 2011-11-15 21:27:07 +0800 | [diff] [blame] | 84 | |
Kerry Sheh | b799351 | 2011-11-15 21:27:07 +0800 | [diff] [blame] | 85 | southstation_led_init(); |
| 86 | } |
| 87 | |
| 88 | int add_mainboard_resources(struct lb_memory *mem) |
| 89 | { |
Kerry Sheh | b799351 | 2011-11-15 21:27:07 +0800 | [diff] [blame] | 90 | return 0; |
| 91 | } |
| 92 | struct chip_operations mainboard_ops = { |
| 93 | CHIP_NAME(CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER " Mainboard") |
| 94 | .enable_dev = southstation_enable, |
| 95 | }; |