1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <baseboard/variants.h>
5 #include <ec/google/chromeec/ec.h>
6 #include <drivers/vpd/vpd.h>
8 #include <soc/intel/apollolake/chip.h>
10 /* SKU ID enumeration */
15 SKU_BIGDADDY_KBDBKLIGHT
,
24 void variant_board_ec_set_skuid(void)
26 google_chromeec_set_sku_id(variant_board_sku());
30 * override SKU ID by VPD definition
32 uint8_t variant_board_sku(void)
34 static int board_sku_num
= -1;
36 char vpd_skuid
[] = "skuid";
41 if (board_sku_num
!= -1)
44 board_sku_num
= sku_strapping_value();
49 if (!vpd_gets(vpd_skuid
, vpd_buffer
, ARRAY_SIZE(vpd_buffer
), VPD_RO_THEN_RW
))
52 vpd_len
= strlen(vpd_buffer
);
55 for (i
= 0; i
< vpd_len
; i
++) {
56 char ch
= vpd_buffer
[i
];
57 if ((ch
< '0') || (ch
> '9')) {
61 vpd_sku_num
= vpd_sku_num
* 10 + (ch
- '0');
64 if (vpd_sku_num
!= -1)
65 board_sku_num
= vpd_sku_num
;
70 void mainboard_devtree_update(struct device
*dev
)
72 /* Override dev tree settings per board */
73 struct soc_intel_apollolake_config
*cfg
= dev
->chip_info
;
76 sku_id
= variant_board_sku();
80 cfg
->usb2eye
[2].Usb20PerPortPeTxiSet
= 4;
81 cfg
->usb2eye
[2].Usb20PerPortTxiSet
= 4;
82 cfg
->usb2eye
[2].Usb20IUsbTxEmphasisEn
= 1;
83 cfg
->usb2eye
[2].Usb20PerPortTxPeHalf
= 0;
85 cfg
->usb2eye
[4].Usb20PerPortPeTxiSet
= 7;
86 cfg
->usb2eye
[4].Usb20PerPortTxiSet
= 7;
87 cfg
->usb2eye
[4].Usb20IUsbTxEmphasisEn
= 1;
88 cfg
->usb2eye
[4].Usb20PerPortTxPeHalf
= 0;
90 case SKU_BIGDADDY_KBDBKLIGHT
:
92 cfg
->usb2eye
[1].Usb20PerPortPeTxiSet
= 7;
93 cfg
->usb2eye
[1].Usb20PerPortTxiSet
= 1;
94 cfg
->usb2eye
[1].Usb20IUsbTxEmphasisEn
= 3;
95 cfg
->usb2eye
[1].Usb20PerPortTxPeHalf
= 0;
97 cfg
->usb2eye
[2].Usb20PerPortPeTxiSet
= 4;
98 cfg
->usb2eye
[2].Usb20PerPortTxiSet
= 4;
99 cfg
->usb2eye
[2].Usb20IUsbTxEmphasisEn
= 1;
100 cfg
->usb2eye
[2].Usb20PerPortTxPeHalf
= 0;
102 cfg
->usb2eye
[4].Usb20PerPortPeTxiSet
= 7;
103 cfg
->usb2eye
[4].Usb20PerPortTxiSet
= 7;
104 cfg
->usb2eye
[4].Usb20IUsbTxEmphasisEn
= 1;
105 cfg
->usb2eye
[4].Usb20PerPortTxPeHalf
= 0;