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> |
Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 6 | |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 7 | #define PCH_XHCI_USB2_PORT_STATUS_REG 0x480 |
| 8 | #define PCH_XHCI_USB3_PORT_STATUS_REG 0x520 |
| 9 | #define PCH_XHCI_USB2_PORT_NUM 10 |
| 10 | #define PCH_XHCI_USB3_PORT_NUM 4 |
Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 11 | |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 12 | #define TCSS_XHCI_USB2_PORT_STATUS_REG 0x480 |
| 13 | #define TCSS_XHCI_USB3_PORT_STATUS_REG 0x490 |
| 14 | #define TCSS_XHCI_USB2_PORT_NUM 1 |
| 15 | #define TCSS_XHCI_USB3_PORT_NUM 4 |
| 16 | |
| 17 | static const struct xhci_usb_info pch_usb_info = { |
| 18 | .usb2_port_status_reg = PCH_XHCI_USB2_PORT_STATUS_REG, |
| 19 | .num_usb2_ports = PCH_XHCI_USB2_PORT_NUM, |
| 20 | .usb3_port_status_reg = PCH_XHCI_USB3_PORT_STATUS_REG, |
| 21 | .num_usb3_ports = PCH_XHCI_USB3_PORT_NUM, |
Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 22 | }; |
| 23 | |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 24 | static const struct xhci_usb_info tcss_usb_info = { |
| 25 | .usb2_port_status_reg = TCSS_XHCI_USB2_PORT_STATUS_REG, |
| 26 | .num_usb2_ports = TCSS_XHCI_USB2_PORT_NUM, |
| 27 | .usb3_port_status_reg = TCSS_XHCI_USB3_PORT_STATUS_REG, |
| 28 | .num_usb3_ports = TCSS_XHCI_USB3_PORT_NUM, |
| 29 | }; |
| 30 | |
| 31 | 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] | 32 | { |
Tim Wawrzynczak | 56fcfb5 | 2020-11-10 13:39:37 -0700 | [diff] [blame] | 33 | if (xhci_dev == PCH_DEVFN_XHCI) |
| 34 | return &pch_usb_info; |
| 35 | else if (xhci_dev == SA_DEVFN_TCSS_XHCI) |
| 36 | return &tcss_usb_info; |
| 37 | |
| 38 | return NULL; |
Karthikeyan Ramasubramanian | fa9e8f9 | 2020-11-04 22:22:46 -0700 | [diff] [blame] | 39 | } |