Angel Pons | 58c0d32 | 2020-04-05 13:20:46 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 2 | |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 3 | #include <endian.h> |
| 4 | #include <string.h> |
Angel Pons | 52e48b5 | 2021-01-28 17:03:19 +0100 | [diff] [blame] | 5 | #include <southbridge/intel/lynxpoint/lp_gpio.h> |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 6 | #include <soc/pei_data.h> |
| 7 | #include <soc/romstage.h> |
| 8 | #include <ec/google/chromeec/ec.h> |
| 9 | #include <mainboard/google/auron/ec.h> |
Angel Pons | af4e8e8 | 2021-01-20 21:47:31 +0100 | [diff] [blame] | 10 | #include <mainboard/google/auron/variant.h> |
| 11 | |
| 12 | /* Gandof board memory configuration GPIOs */ |
| 13 | #define SPD_GPIO_BIT0 13 |
| 14 | #define SPD_GPIO_BIT1 9 |
| 15 | #define SPD_GPIO_BIT2 47 |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 16 | |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 17 | /* Copy SPD data for on-board memory */ |
| 18 | void mainboard_fill_spd_data(struct pei_data *pei_data) |
| 19 | { |
Angel Pons | f9acd37 | 2021-01-20 23:25:59 +0100 | [diff] [blame] | 20 | const int gpio_vector[] = { |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 21 | SPD_GPIO_BIT0, |
| 22 | SPD_GPIO_BIT1, |
Angel Pons | f9acd37 | 2021-01-20 23:25:59 +0100 | [diff] [blame] | 23 | SPD_GPIO_BIT2, |
| 24 | -1, |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 25 | }; |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 26 | |
Angel Pons | f9acd37 | 2021-01-20 23:25:59 +0100 | [diff] [blame] | 27 | const unsigned int spd_index = get_gpios(gpio_vector); |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 28 | |
Angel Pons | 292a764 | 2021-01-20 22:24:22 +0100 | [diff] [blame] | 29 | fill_spd_for_index(pei_data->spd_data[0][0], spd_index); |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 30 | |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 31 | /* Index 0-2 are 4GB config with both CH0 and CH1. |
| 32 | * Index 4-6 are 2GB config with CH0 only. */ |
| 33 | if (spd_index > 3) |
| 34 | pei_data->dimm_channel1_disabled = 3; |
| 35 | else |
Angel Pons | 292a764 | 2021-01-20 22:24:22 +0100 | [diff] [blame] | 36 | memcpy(pei_data->spd_data[1][0], pei_data->spd_data[0][0], SPD_LEN); |
Marc Jones | d862121 | 2015-06-09 21:18:38 -0600 | [diff] [blame] | 37 | } |