blob: c0f6c639d3a7dacdb712bc815a9af8db882ca7f2 [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
3#ifndef RAMINIT_H
4#define RAMINIT_H
5
Angel Ponsd0f971f2021-03-12 14:20:05 +01006#include <types.h>
Aaron Durbin76c37002012-10-30 09:03:43 -05007
Angel Pons90ae0892021-03-12 17:00:52 +01008#define SPD_MEMORY_DOWN 0xff
9
10struct spd_info {
11 uint8_t addresses[4];
12 unsigned int spd_index;
13};
14
Angel Pons76def382021-03-12 18:41:59 +010015#if CONFIG(INTEL_LYNXPOINT_LP)
16#define MAX_USB2_PORTS 10
17#define MAX_USB3_PORTS 4
18#else
19#define MAX_USB2_PORTS 14
20#define MAX_USB3_PORTS 6
21#endif
22
Angel Ponsd0f971f2021-03-12 14:20:05 +010023/* There are 8 OC pins */
24#define USB_OC_PIN_SKIP 8
25
26enum usb2_port_location {
27 USB_PORT_SKIP = 0,
28 USB_PORT_BACK_PANEL,
29 USB_PORT_FRONT_PANEL,
30 USB_PORT_DOCK,
31 USB_PORT_MINI_PCIE,
32 USB_PORT_FLEX,
33 USB_PORT_INTERNAL,
34};
35
36/*
37 * USB port length is in MRC format: binary-coded decimal length in tenths of an inch.
38 * 4.2 inches -> 0x0042
39 * 12.7 inches -> 0x0127
40 */
41struct usb2_port_config {
42 uint16_t length;
43 bool enable;
44 unsigned short oc_pin;
45 enum usb2_port_location location;
46};
47
48struct usb3_port_config {
49 bool enable;
50 unsigned int oc_pin;
51};
52
Angel Pons33b59c92021-02-11 13:42:20 +010053/* Mainboard-specific USB configuration */
Angel Ponsd0f971f2021-03-12 14:20:05 +010054extern const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS];
55extern const struct usb3_port_config mainboard_usb3_ports[MAX_USB3_PORTS];
Angel Pons33b59c92021-02-11 13:42:20 +010056
Angel Ponsc4ee7142021-03-12 20:48:53 +010057/* Mainboard callback to fill in the SPD addresses */
Angel Pons90ae0892021-03-12 17:00:52 +010058void mb_get_spd_map(struct spd_info *spdi);
Angel Ponsd37b7d82020-07-03 23:52:34 +020059
Angel Ponsd99b6932021-03-12 17:37:42 +010060void perform_raminit(const int s3resume);
Aaron Durbin76c37002012-10-30 09:03:43 -050061
62#endif /* RAMINIT_H */