Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2010 coresystems GmbH |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 5 | * Copyright (C) 2014 Google Inc. |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 17 | #include <cbfs.h> |
| 18 | #include <console/console.h> |
Duncan Laurie | 2663a55 | 2014-05-14 15:59:37 -0700 | [diff] [blame] | 19 | #include <string.h> |
| 20 | #include <ec/google/chromeec/ec.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 21 | #include <soc/cpu.h> |
| 22 | #include <soc/gpio.h> |
| 23 | #include <soc/pei_data.h> |
| 24 | #include <soc/pei_wrapper.h> |
| 25 | #include <soc/pm.h> |
| 26 | #include <soc/romstage.h> |
Duncan Laurie | fe8b788 | 2014-05-22 08:22:51 -0700 | [diff] [blame] | 27 | #include <mainboard/google/samus/spd/spd.h> |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 28 | #include <mainboard/google/samus/gpio.h> |
Duncan Laurie | 4327624 | 2014-11-11 08:31:26 -0800 | [diff] [blame] | 29 | #include <ec/google/chromeec/ec.h> |
| 30 | #include "board_version.h" |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 31 | |
Duncan Laurie | 2663a55 | 2014-05-14 15:59:37 -0700 | [diff] [blame] | 32 | void mainboard_romstage_entry(struct romstage_params *rp) |
| 33 | { |
| 34 | struct pei_data pei_data; |
| 35 | |
Duncan Laurie | 515d3d2 | 2014-07-15 13:36:52 -0700 | [diff] [blame] | 36 | post_code(0x31); |
| 37 | |
| 38 | if (rp->power_state->prev_sleep_state != SLEEP_STATE_S3) |
| 39 | google_chromeec_kbbacklight(100); |
Duncan Laurie | 2663a55 | 2014-05-14 15:59:37 -0700 | [diff] [blame] | 40 | |
Duncan Laurie | 4327624 | 2014-11-11 08:31:26 -0800 | [diff] [blame] | 41 | printk(BIOS_INFO, "MLB: board version %s\n", samus_board_version()); |
Duncan Laurie | 25c6f75 | 2014-05-22 08:25:36 -0700 | [diff] [blame] | 42 | |
Duncan Laurie | f6d7baa | 2014-09-18 12:56:04 -0700 | [diff] [blame] | 43 | /* Ensure the EC and PD are in the right mode for recovery */ |
Duncan Laurie | 2663a55 | 2014-05-14 15:59:37 -0700 | [diff] [blame] | 44 | google_chromeec_early_init(); |
| 45 | |
| 46 | /* Initialize GPIOs */ |
| 47 | init_gpios(mainboard_gpio_config); |
| 48 | |
| 49 | /* Fill out PEI DATA */ |
| 50 | memset(&pei_data, 0, sizeof(pei_data)); |
| 51 | mainboard_fill_pei_data(&pei_data); |
| 52 | mainboard_fill_spd_data(&pei_data); |
| 53 | rp->pei_data = &pei_data; |
| 54 | |
Duncan Laurie | 6a342cb | 2014-07-15 13:40:21 -0700 | [diff] [blame] | 55 | /* Initalize memory */ |
Duncan Laurie | 2663a55 | 2014-05-14 15:59:37 -0700 | [diff] [blame] | 56 | romstage_common(rp); |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 57 | |
Duncan Laurie | 808a254 | 2014-07-15 13:41:18 -0700 | [diff] [blame] | 58 | /* Bring SSD out of reset */ |
| 59 | set_gpio(SAMUS_GPIO_SSD_RESET_L, GPIO_OUT_HIGH); |
| 60 | |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 61 | /* |
Duncan Laurie | 2663a55 | 2014-05-14 15:59:37 -0700 | [diff] [blame] | 62 | * Enable PP3300_AUTOBAHN_EN after initial GPIO setup |
| 63 | * to prevent possible brownout. |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 64 | */ |
Duncan Laurie | 2663a55 | 2014-05-14 15:59:37 -0700 | [diff] [blame] | 65 | set_gpio(SAMUS_GPIO_PP3300_AUTOBAHN_EN, GPIO_OUT_HIGH); |
Duncan Laurie | ddc3e42 | 2013-10-02 16:10:54 -0700 | [diff] [blame] | 66 | } |