diff mbox

[resent] PCI: rcar: Add PCIE_CONF_REGNO macro for PCIECAR register

Message ID 8737z5efjt.wl%kuninori.morimoto.gx@renesas.com
State Not Applicable
Headers show

Commit Message

Kuninori Morimoto Aug. 27, 2015, 12:37 a.m. UTC
From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

The reg variable used when setting PCIECAR register need to be masked by 0xFC
by restriction of the corresponding register.
This adds PCIE_CONF_REGNO are macros for masking changes that PCIE_CONF_REGNO
is used when setting PCIECAR register.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
This patch was posted to ML, but still no response.
I re-sent it because original author has gone now.

 drivers/pci/host/pcie-rcar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Simon Horman Aug. 31, 2015, 6:23 a.m. UTC | #1
On Thu, Aug 27, 2015 at 12:37:00AM +0000, Kuninori Morimoto wrote:
> From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> 
> The reg variable used when setting PCIECAR register need to be masked by 0xFC
> by restriction of the corresponding register.
> This adds PCIE_CONF_REGNO are macros for masking changes that PCIE_CONF_REGNO
> is used when setting PCIECAR register.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> ---
> This patch was posted to ML, but still no response.
> I re-sent it because original author has gone now.
> 
>  drivers/pci/host/pcie-rcar.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index c086210..9fd39cd8b 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -104,6 +104,7 @@
>  #define  PCIE_CONF_BUS(b)	(((b) & 0xff) << 24)
>  #define  PCIE_CONF_DEV(d)	(((d) & 0x1f) << 19)
>  #define  PCIE_CONF_FUNC(f)	(((f) & 0x7) << 16)
> +#define  PCIE_CONF_REGNO(r)	(r & 0xfc)
>  
>  #define RCAR_PCI_MAX_RESOURCES 4
>  #define MAX_NR_INBOUND_MAPS 6
> @@ -227,7 +228,8 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
>  
>  	/* Set the PIO address */
>  	rcar_pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) |
> -		PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) | reg, PCIECAR);
> +		PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) |
> +		PCIE_CONF_REGNO(reg), PCIECAR);
>  
>  	/* Enable the configuration access */
>  	if (bus->parent->number == pcie->root_bus_nr)

This seems to partially duplicate the following line earlier on
in rcar_pcie_config_access().

	reg = where & ~3;

I wonder if that line could be updated to use the new PCIE_CONF_REGNO()
macro. If so it seems that the second hunk of the patch could be dropped.
--
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
Kuninori Morimoto Aug. 31, 2015, 11:52 p.m. UTC | #2
Hi Simon

Thank you for your feedback

> > From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> > 
> > The reg variable used when setting PCIECAR register need to be masked by 0xFC
> > by restriction of the corresponding register.
> > This adds PCIE_CONF_REGNO are macros for masking changes that PCIE_CONF_REGNO
> > is used when setting PCIECAR register.
> > 
> > Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> > ---
(snip)
> This seems to partially duplicate the following line earlier on
> in rcar_pcie_config_access().
> 
> 	reg = where & ~3;
> 
> I wonder if that line could be updated to use the new PCIE_CONF_REGNO()
> macro. If so it seems that the second hunk of the patch could be dropped.

We double checked this, and yes, you are correct.
We don't need this patch. Thank you for pointing it.
--
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
diff mbox

Patch

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index c086210..9fd39cd8b 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -104,6 +104,7 @@ 
 #define  PCIE_CONF_BUS(b)	(((b) & 0xff) << 24)
 #define  PCIE_CONF_DEV(d)	(((d) & 0x1f) << 19)
 #define  PCIE_CONF_FUNC(f)	(((f) & 0x7) << 16)
+#define  PCIE_CONF_REGNO(r)	(r & 0xfc)
 
 #define RCAR_PCI_MAX_RESOURCES 4
 #define MAX_NR_INBOUND_MAPS 6
@@ -227,7 +228,8 @@  static int rcar_pcie_config_access(struct rcar_pcie *pcie,
 
 	/* Set the PIO address */
 	rcar_pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) |
-		PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) | reg, PCIECAR);
+		PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) |
+		PCIE_CONF_REGNO(reg), PCIECAR);
 
 	/* Enable the configuration access */
 	if (bus->parent->number == pcie->root_bus_nr)