* [PATCH 1/3] PCI: tegra: Remove unused field
@ 2016-02-09 14:52 Thierry Reding
2016-02-09 14:52 ` [PATCH 2/3] PCI: tegra: Track bus -> CPU mapping Thierry Reding
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thierry Reding @ 2016-02-09 14:52 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Stephen Warren, Alexandre Courbot, linux-pci, linux-tegra
From: Thierry Reding <treding@nvidia.com>
The num_ports field of the tegra_pcie structure is never used so it can
be safely removed.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/pci/host/pci-tegra.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 4cb8157a4678..82d7ad3a1c3a 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -295,7 +295,6 @@ struct tegra_pcie {
struct tegra_msi msi;
struct list_head ports;
- unsigned int num_ports;
u32 xbar_config;
struct regulator_bulk_data *supplies;
--
2.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] PCI: tegra: Track bus -> CPU mapping
2016-02-09 14:52 [PATCH 1/3] PCI: tegra: Remove unused field Thierry Reding
@ 2016-02-09 14:52 ` Thierry Reding
2016-02-09 14:52 ` [PATCH 3/3] PCI: tegra: Remove misleading PHYS_OFFSET Thierry Reding
2016-03-08 21:44 ` [PATCH 1/3] PCI: tegra: Remove unused field Bjorn Helgaas
2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2016-02-09 14:52 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Stephen Warren, Alexandre Courbot, linux-pci, linux-tegra
From: Thierry Reding <treding@nvidia.com>
Track the offsets of the bus -> CPU mapping for I/O and memory. This is
cosmetic for current Tegra chips because the offset is always 0. But to
properly support legacy use-cases, like VGA, this would be needed so
that PCI bus addresses can be relocated.
While at it, also request the I/O resource both in physical memory and
I/O space to make /proc/iomem consistent, as well as add the I/O region
to the list of host bridge resources.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/pci/host/pci-tegra.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 82d7ad3a1c3a..f6fc54b48606 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -281,6 +281,11 @@ struct tegra_pcie {
struct resource prefetch;
struct resource busn;
+ struct {
+ resource_size_t mem;
+ resource_size_t io;
+ } offset;
+
struct clk *pex_clk;
struct clk *afi_clk;
struct clk *pll_e;
@@ -614,6 +619,17 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys)
struct tegra_pcie *pcie = sys_to_pcie(sys);
int err;
+ sys->mem_offset = pcie->offset.mem;
+ sys->io_offset = pcie->offset.io;
+
+ err = devm_request_resource(pcie->dev, &pcie->all, &pcie->io);
+ if (err < 0)
+ return err;
+
+ err = devm_request_resource(pcie->dev, &ioport_resource, &pcie->pio);
+ if (err < 0)
+ return err;
+
err = devm_request_resource(pcie->dev, &pcie->all, &pcie->mem);
if (err < 0)
return err;
@@ -622,6 +638,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys)
if (err)
return err;
+ pci_add_resource_offset(&sys->resources, &pcie->pio, sys->io_offset);
pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset);
pci_add_resource_offset(&sys->resources, &pcie->prefetch,
sys->mem_offset);
@@ -1729,6 +1746,9 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
switch (res.flags & IORESOURCE_TYPE_BITS) {
case IORESOURCE_IO:
+ /* Track the bus -> CPU I/O mapping offset. */
+ pcie->offset.io = res.start - range.pci_addr;
+
memcpy(&pcie->pio, &res, sizeof(res));
pcie->pio.name = np->full_name;
@@ -1749,6 +1769,14 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
break;
case IORESOURCE_MEM:
+ /*
+ * Track the bus -> CPU memory mapping offset. This
+ * assumes that the prefetchable and non-prefetchable
+ * regions will be the last of type IORESOURCE_MEM in
+ * the ranges property.
+ * */
+ pcie->offset.mem = res.start - range.pci_addr;
+
if (res.flags & IORESOURCE_PREFETCH) {
memcpy(&pcie->prefetch, &res, sizeof(res));
pcie->prefetch.name = "prefetchable";
--
2.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] PCI: tegra: Remove misleading PHYS_OFFSET
2016-02-09 14:52 [PATCH 1/3] PCI: tegra: Remove unused field Thierry Reding
2016-02-09 14:52 ` [PATCH 2/3] PCI: tegra: Track bus -> CPU mapping Thierry Reding
@ 2016-02-09 14:52 ` Thierry Reding
2016-03-08 21:44 ` [PATCH 1/3] PCI: tegra: Remove unused field Bjorn Helgaas
2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2016-02-09 14:52 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Stephen Warren, Alexandre Courbot, linux-pci, linux-tegra
From: Thierry Reding <treding@nvidia.com>
BARs are disabled when the size register is 0, so it's misleading to
write a base address into the start register.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/pci/host/pci-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index f6fc54b48606..9d5817546425 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -774,7 +774,7 @@ static void tegra_pcie_setup_translations(struct tegra_pcie *pcie)
afi_writel(pcie, 0, AFI_FPCI_BAR5);
/* map all upstream transactions as uncached */
- afi_writel(pcie, PHYS_OFFSET, AFI_CACHE_BAR0_ST);
+ afi_writel(pcie, 0, AFI_CACHE_BAR0_ST);
afi_writel(pcie, 0, AFI_CACHE_BAR0_SZ);
afi_writel(pcie, 0, AFI_CACHE_BAR1_ST);
afi_writel(pcie, 0, AFI_CACHE_BAR1_SZ);
--
2.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] PCI: tegra: Remove unused field
2016-02-09 14:52 [PATCH 1/3] PCI: tegra: Remove unused field Thierry Reding
2016-02-09 14:52 ` [PATCH 2/3] PCI: tegra: Track bus -> CPU mapping Thierry Reding
2016-02-09 14:52 ` [PATCH 3/3] PCI: tegra: Remove misleading PHYS_OFFSET Thierry Reding
@ 2016-03-08 21:44 ` Bjorn Helgaas
2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2016-03-08 21:44 UTC (permalink / raw)
To: Thierry Reding
Cc: Bjorn Helgaas, Stephen Warren, Alexandre Courbot, linux-pci,
linux-tegra
On Tue, Feb 09, 2016 at 03:52:31PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> The num_ports field of the tegra_pcie structure is never used so it can
> be safely removed.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Applied all three of these to pci/host-tegra for v4.6, thanks!
> ---
> drivers/pci/host/pci-tegra.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> index 4cb8157a4678..82d7ad3a1c3a 100644
> --- a/drivers/pci/host/pci-tegra.c
> +++ b/drivers/pci/host/pci-tegra.c
> @@ -295,7 +295,6 @@ struct tegra_pcie {
> struct tegra_msi msi;
>
> struct list_head ports;
> - unsigned int num_ports;
> u32 xbar_config;
>
> struct regulator_bulk_data *supplies;
> --
> 2.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-08 21:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 14:52 [PATCH 1/3] PCI: tegra: Remove unused field Thierry Reding
2016-02-09 14:52 ` [PATCH 2/3] PCI: tegra: Track bus -> CPU mapping Thierry Reding
2016-02-09 14:52 ` [PATCH 3/3] PCI: tegra: Remove misleading PHYS_OFFSET Thierry Reding
2016-03-08 21:44 ` [PATCH 1/3] PCI: tegra: Remove unused field Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).