Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 3 | #include <device/pci_type.h> |
Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 4 | #include <intelblocks/xhci.h> |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 5 | #include <soc/pci_devs.h> |
Elyes Haouas | cbbbb6c | 2022-10-22 22:15:27 +0200 | [diff] [blame] | 6 | #include <stddef.h> |
Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 7 | |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 8 | #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 Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 12 | |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 13 | #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 | |
| 18 | static 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 Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 23 | }; |
| 24 | |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 25 | static 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 | |
| 32 | const struct xhci_usb_info *soc_get_xhci_usb_info(pci_devfn_t xhci_dev) |
Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 33 | { |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 34 | 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 Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 40 | } |