blob: af201aa4db2e92a0847e313c76273713acd45ee4 [file] [log] [blame]
Karthikeyan Ramasubramanianfa9e8f92020-11-04 22:22:46 -07001/* SPDX-License-Identifier: GPL-2.0-only */
2
Tim Wawrzynczak56fcfb52020-11-10 13:39:37 -07003#include <device/pci_type.h>
Karthikeyan Ramasubramanianfa9e8f92020-11-04 22:22:46 -07004#include <intelblocks/xhci.h>
Tim Wawrzynczak56fcfb52020-11-10 13:39:37 -07005#include <soc/pci_devs.h>
Elyes Haouascbbbb6c2022-10-22 22:15:27 +02006#include <stddef.h>
Karthikeyan Ramasubramanianfa9e8f92020-11-04 22:22:46 -07007
Tim Wawrzynczak56fcfb52020-11-10 13:39:37 -07008#define PCH_XHCI_USB2_PORT_STATUS_REG 0x480
9#define PCH_XHCI_USB3_PORT_STATUS_REG 0x520
10#define PCH_XHCI_USB2_PORT_NUM 10
11#define PCH_XHCI_USB3_PORT_NUM 4
Karthikeyan Ramasubramanianfa9e8f92020-11-04 22:22:46 -070012
Tim Wawrzynczak56fcfb52020-11-10 13:39:37 -070013#define TCSS_XHCI_USB2_PORT_STATUS_REG 0x480
14#define TCSS_XHCI_USB3_PORT_STATUS_REG 0x490
15#define TCSS_XHCI_USB2_PORT_NUM 1
16#define TCSS_XHCI_USB3_PORT_NUM 4
17
18static const struct xhci_usb_info pch_usb_info = {
19 .usb2_port_status_reg = PCH_XHCI_USB2_PORT_STATUS_REG,
20 .num_usb2_ports = PCH_XHCI_USB2_PORT_NUM,
21 .usb3_port_status_reg = PCH_XHCI_USB3_PORT_STATUS_REG,
22 .num_usb3_ports = PCH_XHCI_USB3_PORT_NUM,
Karthikeyan Ramasubramanianfa9e8f92020-11-04 22:22:46 -070023};
24
Tim Wawrzynczak56fcfb52020-11-10 13:39:37 -070025static const struct xhci_usb_info tcss_usb_info = {
26 .usb2_port_status_reg = TCSS_XHCI_USB2_PORT_STATUS_REG,
27 .num_usb2_ports = TCSS_XHCI_USB2_PORT_NUM,
28 .usb3_port_status_reg = TCSS_XHCI_USB3_PORT_STATUS_REG,
29 .num_usb3_ports = TCSS_XHCI_USB3_PORT_NUM,
30};
31
32const struct xhci_usb_info *soc_get_xhci_usb_info(pci_devfn_t xhci_dev)
Karthikeyan Ramasubramanianfa9e8f92020-11-04 22:22:46 -070033{
Tim Wawrzynczak56fcfb52020-11-10 13:39:37 -070034 if (xhci_dev == PCH_DEVFN_XHCI)
35 return &pch_usb_info;
36 else if (xhci_dev == SA_DEVFN_TCSS_XHCI)
37 return &tcss_usb_info;
38
39 return NULL;
Karthikeyan Ramasubramanianfa9e8f92020-11-04 22:22:46 -070040}