aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2019-12-06 15:06:49 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-10 11:36:28 +0100
commitecd0fbd12d0fb5ee030d97d5be44766552aba07c (patch)
treee9392af94e3972f6282a77ff7ee260d934547b10 /drivers/usb/host
parentusb: host: xhci-tegra: Extract firmware enable helper (diff)
downloadlinux-dev-ecd0fbd12d0fb5ee030d97d5be44766552aba07c.tar.xz
linux-dev-ecd0fbd12d0fb5ee030d97d5be44766552aba07c.zip
usb: host: xhci-tegra: Reuse stored register base address
The base address of the XUSB controller's registers is already stored in the HCD. Move assignment to the HCD fields to an earlier point so that they can be reused in the tegra_xusb_config() function. This avoids the need to pass the base address as an extra parameter, which in turn comes in handy in subsequent patches that need to call this function from the suspend/resume paths where these values are no longer readily available. Based on work by JC Kuo <jckuo@nvidia.com>. Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20191206140653.2085561-7-thierry.reding@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/xhci-tegra.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 499104c05668..31411f85e742 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -626,9 +626,9 @@ static irqreturn_t tegra_xusb_mbox_thread(int irq, void *data)
return IRQ_HANDLED;
}
-static void tegra_xusb_config(struct tegra_xusb *tegra,
- struct resource *regs)
+static void tegra_xusb_config(struct tegra_xusb *tegra)
{
+ u32 regs = tegra->hcd->rsrc_start;
u32 value;
if (tegra->soc->has_ipfs) {
@@ -642,7 +642,7 @@ static void tegra_xusb_config(struct tegra_xusb *tegra,
/* Program BAR0 space */
value = fpci_readl(tegra, XUSB_CFG_4);
value &= ~(XUSB_BASE_ADDR_MASK << XUSB_BASE_ADDR_SHIFT);
- value |= regs->start & (XUSB_BASE_ADDR_MASK << XUSB_BASE_ADDR_SHIFT);
+ value |= regs & (XUSB_BASE_ADDR_MASK << XUSB_BASE_ADDR_SHIFT);
fpci_writel(tegra, value, XUSB_CFG_4);
usleep_range(100, 200);
@@ -1226,6 +1226,10 @@ static int tegra_xusb_probe(struct platform_device *pdev)
goto put_powerdomains;
}
+ tegra->hcd->regs = tegra->regs;
+ tegra->hcd->rsrc_start = regs->start;
+ tegra->hcd->rsrc_len = resource_size(regs);
+
/*
* This must happen after usb_create_hcd(), because usb_create_hcd()
* will overwrite the drvdata of the device with the hcd it creates.
@@ -1249,7 +1253,7 @@ static int tegra_xusb_probe(struct platform_device *pdev)
goto disable_phy;
}
- tegra_xusb_config(tegra, regs);
+ tegra_xusb_config(tegra);
/*
* The XUSB Falcon microcontroller can only address 40 bits, so set
@@ -1273,10 +1277,6 @@ static int tegra_xusb_probe(struct platform_device *pdev)
goto free_firmware;
}
- tegra->hcd->regs = tegra->regs;
- tegra->hcd->rsrc_start = regs->start;
- tegra->hcd->rsrc_len = resource_size(regs);
-
err = usb_add_hcd(tegra->hcd, tegra->xhci_irq, IRQF_SHARED);
if (err < 0) {
dev_err(&pdev->dev, "failed to add USB HCD: %d\n", err);