blob: f166088a8e93c4a55c30dc486a924cf69ee77515 [file] [log] [blame]
amanda_hwangb3b47e12018-03-08 11:04:40 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2018 Google 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
Shelley Chen467cce42018-03-07 14:22:28 -080016#include <arch/cpu.h>
17#include <assert.h>
18#include <baseboard/variants.h>
amanda_hwangb3b47e12018-03-08 11:04:40 +080019#include <chip.h>
20#include <device/device.h>
21#include <ec/google/chromeec/ec.h>
Shelley Chen467cce42018-03-07 14:22:28 -080022#include <smbios.h>
23#include <soc/ramstage.h>
24#include <string.h>
amanda_hwang04ccd5f2018-03-16 13:43:52 +080025#include <variant/sku.h>
amanda_hwangb3b47e12018-03-08 11:04:40 +080026
amanda_hwang04ccd5f2018-03-16 13:43:52 +080027uint16_t variant_board_sku(void)
amanda_hwangb3b47e12018-03-08 11:04:40 +080028{
29 static int sku_id = -1;
30 uint32_t id;
31 if (sku_id >= 0)
32 return sku_id;
33 if (google_chromeec_cbi_get_sku_id(&id))
34 return SKU_UNKNOWN;
35 sku_id = id;
36 return sku_id;
37}
38
39void variant_devtree_update(void)
40{
41 /* Override dev tree settings per board */
amanda_hwang04ccd5f2018-03-16 13:43:52 +080042 uint16_t sku_id = variant_board_sku();
amanda_hwangb3b47e12018-03-08 11:04:40 +080043 device_t root = SA_DEV_ROOT;
44 config_t *cfg = root->chip_info;
45 switch (sku_id) {
46 case SKU_1_VAYNE:
47 cfg->usb2_ports[5].enable = 0;//rear camera
48 break;
49 default:
50 break;
51 }
52}
Shelley Chen467cce42018-03-07 14:22:28 -080053
54const char *smbios_mainboard_sku(void)
55{
56 static char sku_str[9]; /* sku{0..65535} (basically up to FFFF) */
57
amanda_hwang04ccd5f2018-03-16 13:43:52 +080058 snprintf(sku_str, sizeof(sku_str), "sku%d", variant_board_sku());
Shelley Chen467cce42018-03-07 14:22:28 -080059
60 return sku_str;
61}