* [PATCH 1/2] PCI: imx6: Return the real error code
@ 2015-09-10 23:43 Fabio Estevam
2015-09-10 23:43 ` [PATCH 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
2015-09-11 8:25 ` [PATCH 1/2] PCI: imx6: Return the real error code Lucas Stach
0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2015-09-10 23:43 UTC (permalink / raw)
To: bhelgaas; +Cc: l.stach, linux-pci, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
When devm_request_irq() fails we should better return the real
error code instead of returning a 'fake' one.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/pci/host/pci-imx6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 8f3a981..2d0d0fe 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -539,7 +539,7 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp,
IRQF_SHARED, "mx6-pcie-msi", pp);
if (ret) {
dev_err(&pdev->dev, "failed to request MSI irq\n");
- return -ENODEV;
+ return ret;
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] PCI: imx6: Add some defines for improving code readability
2015-09-10 23:43 [PATCH 1/2] PCI: imx6: Return the real error code Fabio Estevam
@ 2015-09-10 23:43 ` Fabio Estevam
2015-09-11 8:40 ` Lucas Stach
2015-09-11 8:25 ` [PATCH 1/2] PCI: imx6: Return the real error code Lucas Stach
1 sibling, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2015-09-10 23:43 UTC (permalink / raw)
To: bhelgaas; +Cc: l.stach, linux-pci, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
Instead of having some hardcoded values, it is preferred to use
defines when possible.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/pci/host/pci-imx6.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 2d0d0fe..f7a3951 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -55,6 +55,7 @@ struct imx6_pcie {
#define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16)
#define PCIE_PL_PFLR_FORCE_LINK (1 << 15)
#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
+#define PCIE_PHY_DEBUG_R0_LTSSM_MASK 0x3f
#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29)
#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4)
@@ -74,6 +75,7 @@ struct imx6_pcie {
/* PHY registers (not memory-mapped) */
#define PCIE_PHY_RX_ASIC_OUT 0x100D
+#define PCIE_PHY_RX_ASIC_OUT_VALID 1
#define PHY_RX_OVRD_IN_LO 0x1005
#define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5)
@@ -503,10 +505,10 @@ static int imx6_pcie_link_up(struct pcie_port *pp)
pcie_phy_read(pp->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid);
debug_r0 = readl(pp->dbi_base + PCIE_PHY_DEBUG_R0);
- if (rx_valid & 0x01)
+ if (rx_valid & PCIE_PHY_RX_ASIC_OUT_VALID)
return 0;
- if ((debug_r0 & 0x3f) != 0x0d)
+ if ((debug_r0 & PCIE_PHY_DEBUG_R0_LTSSM_MASK) != 0x0d)
return 0;
dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] PCI: imx6: Return the real error code
2015-09-10 23:43 [PATCH 1/2] PCI: imx6: Return the real error code Fabio Estevam
2015-09-10 23:43 ` [PATCH 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
@ 2015-09-11 8:25 ` Lucas Stach
1 sibling, 0 replies; 4+ messages in thread
From: Lucas Stach @ 2015-09-11 8:25 UTC (permalink / raw)
To: Fabio Estevam; +Cc: bhelgaas, linux-pci, Fabio Estevam
Am Donnerstag, den 10.09.2015, 20:43 -0300 schrieb Fabio Estevam:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> When devm_request_irq() fails we should better return the real
> error code instead of returning a 'fake' one.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/pci/host/pci-imx6.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
> index 8f3a981..2d0d0fe 100644
> --- a/drivers/pci/host/pci-imx6.c
> +++ b/drivers/pci/host/pci-imx6.c
> @@ -539,7 +539,7 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp,
> IRQF_SHARED, "mx6-pcie-msi", pp);
> if (ret) {
> dev_err(&pdev->dev, "failed to request MSI irq\n");
> - return -ENODEV;
> + return ret;
> }
> }
>
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] PCI: imx6: Add some defines for improving code readability
2015-09-10 23:43 ` [PATCH 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
@ 2015-09-11 8:40 ` Lucas Stach
0 siblings, 0 replies; 4+ messages in thread
From: Lucas Stach @ 2015-09-11 8:40 UTC (permalink / raw)
To: Fabio Estevam; +Cc: bhelgaas, linux-pci, Fabio Estevam
Am Donnerstag, den 10.09.2015, 20:43 -0300 schrieb Fabio Estevam:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Instead of having some hardcoded values, it is preferred to use
> defines when possible.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/pci/host/pci-imx6.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
> index 2d0d0fe..f7a3951 100644
> --- a/drivers/pci/host/pci-imx6.c
> +++ b/drivers/pci/host/pci-imx6.c
> @@ -55,6 +55,7 @@ struct imx6_pcie {
> #define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16)
> #define PCIE_PL_PFLR_FORCE_LINK (1 << 15)
> #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
> +#define PCIE_PHY_DEBUG_R0_LTSSM_MASK 0x3f
> #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
> #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29)
> #define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4)
> @@ -74,6 +75,7 @@ struct imx6_pcie {
>
> /* PHY registers (not memory-mapped) */
> #define PCIE_PHY_RX_ASIC_OUT 0x100D
> +#define PCIE_PHY_RX_ASIC_OUT_VALID 1
I know these defines are a bit inconsistent right now, but for new
defines I would like them in a way that they are clearly visible as a
bitfields. Please change this to (1 << 0).
For the LTSSM_MASK the same logic might also improve readability.
Regards,
Lucas
>
> #define PHY_RX_OVRD_IN_LO 0x1005
> #define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5)
> @@ -503,10 +505,10 @@ static int imx6_pcie_link_up(struct pcie_port *pp)
> pcie_phy_read(pp->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid);
> debug_r0 = readl(pp->dbi_base + PCIE_PHY_DEBUG_R0);
>
> - if (rx_valid & 0x01)
> + if (rx_valid & PCIE_PHY_RX_ASIC_OUT_VALID)
> return 0;
>
> - if ((debug_r0 & 0x3f) != 0x0d)
> + if ((debug_r0 & PCIE_PHY_DEBUG_R0_LTSSM_MASK) != 0x0d)
> return 0;
>
> dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-11 8:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10 23:43 [PATCH 1/2] PCI: imx6: Return the real error code Fabio Estevam
2015-09-10 23:43 ` [PATCH 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
2015-09-11 8:40 ` Lucas Stach
2015-09-11 8:25 ` [PATCH 1/2] PCI: imx6: Return the real error code Lucas Stach
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).