linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] PCI: tegra: Make register definitions consistent
@ 2016-06-30 13:14 Thierry Reding
  2016-06-30 13:14 ` [PATCH 2/3] PCI: tegra: Use pci_remap_iospace() Thierry Reding
  2016-06-30 13:14 ` [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem Thierry Reding
  0 siblings, 2 replies; 6+ messages in thread
From: Thierry Reding @ 2016-06-30 13:14 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Bjorn Helgaas, linux-tegra, linux-pci

From: Thierry Reding <treding@nvidia.com>

Most of the register definitions use lowercase hexadecimal values, with
a few exceptions using uppercase. Convert the latter to be more in line
with the former.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/pci/host/pci-tegra.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index c388468c202a..9595518f541d 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -183,26 +183,26 @@
 
 #define AFI_PEXBIAS_CTRL_0		0x168
 
-#define RP_VEND_XP	0x00000F00
+#define RP_VEND_XP	0x00000f00
 #define  RP_VEND_XP_DL_UP	(1 << 30)
 
-#define RP_PRIV_MISC	0x00000FE0
-#define  RP_PRIV_MISC_PRSNT_MAP_EP_PRSNT (0xE << 0)
-#define  RP_PRIV_MISC_PRSNT_MAP_EP_ABSNT (0xF << 0)
+#define RP_PRIV_MISC	0x00000fe0
+#define  RP_PRIV_MISC_PRSNT_MAP_EP_PRSNT (0xe << 0)
+#define  RP_PRIV_MISC_PRSNT_MAP_EP_ABSNT (0xf << 0)
 
 #define RP_LINK_CONTROL_STATUS			0x00000090
 #define  RP_LINK_CONTROL_STATUS_DL_LINK_ACTIVE	0x20000000
 #define  RP_LINK_CONTROL_STATUS_LINKSTAT_MASK	0x3fff0000
 
-#define PADS_CTL_SEL		0x0000009C
+#define PADS_CTL_SEL		0x0000009c
 
-#define PADS_CTL		0x000000A0
+#define PADS_CTL		0x000000a0
 #define  PADS_CTL_IDDQ_1L	(1 << 0)
 #define  PADS_CTL_TX_DATA_EN_1L	(1 << 6)
 #define  PADS_CTL_RX_DATA_EN_1L	(1 << 10)
 
-#define PADS_PLL_CTL_TEGRA20			0x000000B8
-#define PADS_PLL_CTL_TEGRA30			0x000000B4
+#define PADS_PLL_CTL_TEGRA20			0x000000b8
+#define PADS_PLL_CTL_TEGRA30			0x000000b4
 #define  PADS_PLL_CTL_RST_B4SM			(1 << 1)
 #define  PADS_PLL_CTL_LOCKDET			(1 << 8)
 #define  PADS_PLL_CTL_REFCLK_MASK		(0x3 << 16)
@@ -214,9 +214,9 @@
 #define  PADS_PLL_CTL_TXCLKREF_DIV5		(1 << 20)
 #define  PADS_PLL_CTL_TXCLKREF_BUF_EN		(1 << 22)
 
-#define PADS_REFCLK_CFG0			0x000000C8
-#define PADS_REFCLK_CFG1			0x000000CC
-#define PADS_REFCLK_BIAS			0x000000D0
+#define PADS_REFCLK_CFG0			0x000000c8
+#define PADS_REFCLK_CFG1			0x000000cc
+#define PADS_REFCLK_BIAS			0x000000d0
 
 /*
  * Fields in PADS_REFCLK_CFG*. Those registers form an array of 16-bit
-- 
2.8.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] PCI: tegra: Use pci_remap_iospace()
  2016-06-30 13:14 [PATCH 1/3] PCI: tegra: Make register definitions consistent Thierry Reding
@ 2016-06-30 13:14 ` Thierry Reding
  2016-06-30 13:14 ` [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem Thierry Reding
  1 sibling, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2016-06-30 13:14 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Bjorn Helgaas, linux-tegra, linux-pci

From: Thierry Reding <treding@nvidia.com>

Use the pci_remap_iospace() function provided by the PCI core, rather
than the 32-bit ARM-specific pci_ioremap_io().

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 9595518f541d..f04b062e8c67 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -645,7 +645,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys)
 				sys->mem_offset);
 	pci_add_resource(&sys->resources, &pcie->busn);
 
-	pci_ioremap_io(pcie->pio.start, pcie->io.start);
+	pci_remap_iospace(&pcie->pio, pcie->io.start);
 
 	return 1;
 }
-- 
2.8.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem
  2016-06-30 13:14 [PATCH 1/3] PCI: tegra: Make register definitions consistent Thierry Reding
  2016-06-30 13:14 ` [PATCH 2/3] PCI: tegra: Use pci_remap_iospace() Thierry Reding
@ 2016-06-30 13:14 ` Thierry Reding
  2016-07-25 21:28   ` Bjorn Helgaas
  1 sibling, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2016-06-30 13:14 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Bjorn Helgaas, linux-tegra, linux-pci

From: Thierry Reding <treding@nvidia.com>

In practice this value will never be used and it hinders portability of
the driver, so remove it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/pci/host/pci-tegra.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index f04b062e8c67..bbf77a49517d 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -2249,8 +2249,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 	if (err < 0)
 		return err;
 
-	pcibios_min_mem = 0;
-
 	err = tegra_pcie_get_resources(pcie);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to request resources: %d\n", err);
-- 
2.8.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem
  2016-06-30 13:14 ` [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem Thierry Reding
@ 2016-07-25 21:28   ` Bjorn Helgaas
  2016-07-26  9:54     ` Thierry Reding
  0 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2016-07-25 21:28 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Bjorn Helgaas, linux-tegra, linux-pci

On Thu, Jun 30, 2016 at 03:14:30PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> In practice this value will never be used and it hinders portability of
> the driver, so remove it.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/pci/host/pci-tegra.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> index f04b062e8c67..bbf77a49517d 100644
> --- a/drivers/pci/host/pci-tegra.c
> +++ b/drivers/pci/host/pci-tegra.c
> @@ -2249,8 +2249,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
>  	if (err < 0)
>  		return err;
>  
> -	pcibios_min_mem = 0;

unsigned long pcibios_min_mem = 0x01000000;   # arch/arm/mm/iomap.c
#define PCIBIOS_MIN_MEM pcibios_min_mem       # arch/arm/include/asm/pci.h

PCIBIOS_MIN_MEM is used in __pci_assign_resource().

It looks to me like we still use pcibios_min_mem; am I missing something?

>  	err = tegra_pcie_get_resources(pcie);
>  	if (err < 0) {
>  		dev_err(&pdev->dev, "failed to request resources: %d\n", err);
> -- 
> 2.8.3
> 
> --
> 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] 6+ messages in thread

* Re: [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem
  2016-07-25 21:28   ` Bjorn Helgaas
@ 2016-07-26  9:54     ` Thierry Reding
  2016-07-26 19:59       ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2016-07-26  9:54 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Bjorn Helgaas, linux-tegra, linux-pci

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]

On Mon, Jul 25, 2016 at 04:28:50PM -0500, Bjorn Helgaas wrote:
> On Thu, Jun 30, 2016 at 03:14:30PM +0200, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > In practice this value will never be used and it hinders portability of
> > the driver, so remove it.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  drivers/pci/host/pci-tegra.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> > index f04b062e8c67..bbf77a49517d 100644
> > --- a/drivers/pci/host/pci-tegra.c
> > +++ b/drivers/pci/host/pci-tegra.c
> > @@ -2249,8 +2249,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
> >  	if (err < 0)
> >  		return err;
> >  
> > -	pcibios_min_mem = 0;
> 
> unsigned long pcibios_min_mem = 0x01000000;   # arch/arm/mm/iomap.c
> #define PCIBIOS_MIN_MEM pcibios_min_mem       # arch/arm/include/asm/pci.h
> 
> PCIBIOS_MIN_MEM is used in __pci_assign_resource().
> 
> It looks to me like we still use pcibios_min_mem; am I missing something?

The problem is that pcibios_min_mem is only defined on 32-bit ARM, so
we'd need to conditionalize (with a preprocessor macro) the usage.
However it turns out that it's not necessary because PCIBIOS_MIN_MEM
only serves as a lower bound during resource assignment.

pci_bus_alloc_resource() will eventually end up assigning from one of
the regions defined in device tree and the lowest we'll ever start any
of the memory regions is 0x12000000 (Tegra124).

So instead of conditionalizing I've simply dropped the assignment
because the default works fine for Tegra.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem
  2016-07-26  9:54     ` Thierry Reding
@ 2016-07-26 19:59       ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2016-07-26 19:59 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Bjorn Helgaas, linux-tegra, linux-pci

On Tue, Jul 26, 2016 at 11:54:15AM +0200, Thierry Reding wrote:
> On Mon, Jul 25, 2016 at 04:28:50PM -0500, Bjorn Helgaas wrote:
> > On Thu, Jun 30, 2016 at 03:14:30PM +0200, Thierry Reding wrote:
> > > From: Thierry Reding <treding@nvidia.com>
> > > 
> > > In practice this value will never be used and it hinders portability of
> > > the driver, so remove it.
> > > 
> > > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > > ---
> > >  drivers/pci/host/pci-tegra.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> > > index f04b062e8c67..bbf77a49517d 100644
> > > --- a/drivers/pci/host/pci-tegra.c
> > > +++ b/drivers/pci/host/pci-tegra.c
> > > @@ -2249,8 +2249,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
> > >  	if (err < 0)
> > >  		return err;
> > >  
> > > -	pcibios_min_mem = 0;
> > 
> > unsigned long pcibios_min_mem = 0x01000000;   # arch/arm/mm/iomap.c
> > #define PCIBIOS_MIN_MEM pcibios_min_mem       # arch/arm/include/asm/pci.h
> > 
> > PCIBIOS_MIN_MEM is used in __pci_assign_resource().
> > 
> > It looks to me like we still use pcibios_min_mem; am I missing something?
> 
> The problem is that pcibios_min_mem is only defined on 32-bit ARM, so
> we'd need to conditionalize (with a preprocessor macro) the usage.
> However it turns out that it's not necessary because PCIBIOS_MIN_MEM
> only serves as a lower bound during resource assignment.
> 
> pci_bus_alloc_resource() will eventually end up assigning from one of
> the regions defined in device tree and the lowest we'll ever start any
> of the memory regions is 0x12000000 (Tegra124).
> 
> So instead of conditionalizing I've simply dropped the assignment
> because the default works fine for Tegra.

Oh, I see, yep, that makes sense now.  I merged this with the
following changelog:

    PCI: tegra: Stop setting pcibios_min_mem
    
    pcibios_min_mem only exists on 32-bit ARM, so using it in pci-tegra.c
    prevents the driver from being used on other arches.
    
    In __pci_assign_resource(), we clip the available area based on
    PCIBIOS_MIN_MEM.  On 32-bit ARM, this is pcibios_min_mem, with a default
    value of 0x01000000.  For Tegra, we discover the space available for PCI
    resource allocation from the device tree, and the lowest address that will
    ever be available is 0x12000000 (on Tegra124).
    
    The Tegra windows are always higher than the default pcibios_min_mem, so
    the __pci_assign_resource() has no effect, so there's no need to adjust
    pcibios_min_mem here.

Bjorn

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-26 19:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-30 13:14 [PATCH 1/3] PCI: tegra: Make register definitions consistent Thierry Reding
2016-06-30 13:14 ` [PATCH 2/3] PCI: tegra: Use pci_remap_iospace() Thierry Reding
2016-06-30 13:14 ` [PATCH 3/3] PCI: tegra: Stop setting pcibios_min_mem Thierry Reding
2016-07-25 21:28   ` Bjorn Helgaas
2016-07-26  9:54     ` Thierry Reding
2016-07-26 19:59       ` 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).