NVIDIA: SAUCE: usb: gadget: xudc: support hv guest

BugLink: https://bugs.launchpad.net/bugs/2080908

In hypervisor environment, xudc driver cannot access clock, reset,
and power domain directly.

http://nvbugs/3840188

Signed-off-by: Henry Lin <henryl@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Noah Wager <noah.wager@canonical.com>
This commit is contained in:
Henry Lin
2024-03-07 20:41:09 +00:00
committed by Noah Wager
parent f7d3041fed
commit 2dcd8893f2
+25 -1
View File
@@ -2,7 +2,7 @@
/*
* NVIDIA Tegra XUSB device mode controller
*
* Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2013-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2015, Google Inc.
*/
@@ -559,6 +559,7 @@ struct tegra_xudc_soc {
bool port_speed_quirk;
bool has_ipfs;
bool has_pg_support;
bool is_hv_guest;
};
static inline u32 fpci_readl(struct tegra_xudc *xudc, unsigned int offset)
@@ -3697,6 +3698,19 @@ static struct tegra_xudc_soc tegra234_xudc_soc_data = {
.has_pg_support = true,
};
static struct tegra_xudc_soc tegra234_hv_xudc_soc_data = {
.num_phys = 4,
.u1_enable = true,
.u2_enable = true,
.lpm_enable = true,
.invalid_seq_num = false,
.pls_quirk = false,
.port_reset_quirk = false,
.has_ipfs = false,
.has_pg_support = true,
.is_hv_guest = true,
};
static const struct of_device_id tegra_xudc_of_match[] = {
{
.compatible = "nvidia,tegra210-xudc",
@@ -3714,12 +3728,19 @@ static const struct of_device_id tegra_xudc_of_match[] = {
.compatible = "nvidia,tegra234-xudc",
.data = &tegra234_xudc_soc_data
},
{
.compatible = "nvidia,tegra234-hv-xudc",
.data = &tegra234_hv_xudc_soc_data
},
{ }
};
MODULE_DEVICE_TABLE(of, tegra_xudc_of_match);
static void tegra_xudc_powerdomain_remove(struct tegra_xudc *xudc)
{
if (xudc->soc->is_hv_guest)
return;
if (xudc->genpd_dl_ss)
device_link_del(xudc->genpd_dl_ss);
if (xudc->genpd_dl_device)
@@ -3735,6 +3756,9 @@ static int tegra_xudc_powerdomain_init(struct tegra_xudc *xudc)
struct device *dev = xudc->dev;
int err;
if (xudc->soc->is_hv_guest)
return 0;
xudc->genpd_dev_device = dev_pm_domain_attach_by_name(dev, "dev");
if (IS_ERR(xudc->genpd_dev_device)) {
err = PTR_ERR(xudc->genpd_dev_device);