PCI: rcar: Failpath fixes
Subsystems (2)
v4 cover PCI: rcar: Failpath fixes
Multiple minor failpath fixes for the R-Car PCIe driver.
V4: Sync up the version numbers
Rebase on top of Lorenzo's tree
Add new patch fixing bug in the PHY code
Marek Vasut (6):
PCI: rcar: Pull bus clock enable/disable from
rcar_pcie_get_resources()
PCI: rcar: Add missing irq_dispose_mapping() into failpath
PCI: rcar: Teardown MSI setup if rcar_pcie_enable() fails
PCI: rcar: Poll more often in rcar_pcie_wait_for_dl()
PCI: rcar: Remove IRQ mappings in rcar_pcie_enable_msi failpath
PCI: rcar: Shut the PHY down in failpath
drivers/pci/host/pcie-rcar.c | 82 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 16 deletions(-)
Signature · 1 line
2.16.2
PATCH v4 1/6 PCI: rcar: Pull bus clock enable/disable from rcar_pcie_get_resources()
The rcar_pcie_get_resources() is another misnomer with a side effect. The function does not only get resources, but also enables/disables bus clock. This is forgotten in the probe() function though and if anything in probe() fails after rcar_pcie_get_resources() is called, the bus clock are never disabled.
This patch pulls the clock handling out of the rcar_pcie_get_resources() and enables clock after all the resources were requested. Moreover, this patch also always disables the clock in case of failure.
---
V2: No change
V3: No change
V4: Rebase on top of Lorenzo's pci/rcar, fix up the rebase breakage
induced by patches therein
--- drivers/pci/host/pcie-rcar.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/pci/host/pcie-rcar.c +16 -17
@@ -946,32 +946,22 @@ static int rcar_pcie_get_resources(struct rcar_pcie *pcie)dev_err (dev,"cannot get pcie bus clock\n" );return PTR_ERR (pcie->bus_clk); } - err =clk_prepare_enable (pcie->bus_clk); -if (err) -return err; i =irq_of_parse_and_map (dev->of_node,0 );if (!i) {dev_err (dev,"cannot get platform resources for msi interrupt\n" ); - err = -ENOENT ; - goto err_map_reg; +return -ENOENT ; } pcie->msi.irq1 = i; i =irq_of_parse_and_map (dev->of_node,1 );if (!i) {dev_err (dev,"cannot get platform resources for msi interrupt\n" ); - err = -ENOENT ; - goto err_map_reg; +return -ENOENT ; } pcie->msi.irq2 = i;return 0 ; - -err_map_reg: -clk_disable_unprepare (pcie->bus_clk); - -return err; } static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
@@ -1115,22 +1105,28 @@ static int rcar_pcie_probe(struct platform_device *pdev) goto err_pm_put; } + err =clk_prepare_enable (pcie->bus_clk); +if (err) { +dev_err (dev,"failed to enable bus clock: %d\n" , err); + goto err_pm_put; + } + err =rcar_pcie_parse_map_dma_ranges (pcie, dev->of_node);if (err) - goto err_pm_put; + goto err_clk_disable; phy_init_fn =of_device_get_match_data (dev); err =phy_init_fn (pcie);if (err) {dev_err (dev,"failed to init PCIe PHY\n" ); - goto err_pm_put; + goto err_clk_disable; }/* Failure to get a link might just be that no cards are inserted */ if (rcar_pcie_hw_init (pcie)) {dev_info (dev,"PCIe link down\n" ); err = -ENODEV ; - goto err_pm_put; + goto err_clk_disable; } data =rcar_pci_read_reg (pcie,MACSR );
@@ -1142,16 +1138,19 @@ static int rcar_pcie_probe(struct platform_device *pdev)dev_err (dev,"failed to enable MSI support: %d\n" , err); - goto err_pm_put; + goto err_clk_disable; } } err =rcar_pcie_enable (pcie);if (err) - goto err_pm_put; + goto err_clk_disable;return 0 ; +err_clk_disable: +clk_disable_unprepare (pcie->bus_clk); + err_pm_put:pm_runtime_put (dev);
Signature · 1 line
2.16.2
Re: [PATCH v4 1/6] PCI: rcar: Pull bus clock enable/disable from rcar_pcie_get_resources()
Quoted 17 lines · Marek Vasut
The
rcar_pcie_get_resources()is another misnomer with a side effect. The function does not only get resources, but also enables/disables bus clock. This is forgotten in theprobe()function though and if anything inprobe()fails afterrcar_pcie_get_resources()is called, the bus clock are never disabled.This patch pulls the clock handling out of the
rcar_pcie_get_resources()and enables clock after all the resources were requested. Moreover, this patch also always disables the clock in case of failure.Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>
Quoted 5 lines
---
V2: No change
V3: No change
V4: Rebase on top of Lorenzo's pci/rcar, fix up the rebase breakage
induced by patches therein
Quoted 100 lines
--- drivers/pci/host/pcie-rcar.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)drivers/pci/host/pcie-rcar.c +16
-17@@ -946,32 +946,22 @@ static int rcar_pcie_get_resources(struct rcar_pcie *pcie)dev_err (dev,"cannot get pcie bus clock\n" );return PTR_ERR (pcie->bus_clk); } - err =clk_prepare_enable (pcie->bus_clk); -if (err) -return err; i =irq_of_parse_and_map (dev->of_node,0 );if (!i) {dev_err (dev,"cannot get platform resources for msi interrupt\n" ); - err = -ENOENT ; - goto err_map_reg; +return -ENOENT ; } pcie->msi.irq1 = i; i =irq_of_parse_and_map (dev->of_node,1 );if (!i) {dev_err (dev,"cannot get platform resources for msi interrupt\n" ); - err = -ENOENT ; - goto err_map_reg; +return -ENOENT ; } pcie->msi.irq2 = i;return 0 ; - -err_map_reg: -clk_disable_unprepare (pcie->bus_clk); - -return err; } static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,@@ -1115,22 +1105,28 @@ static int rcar_pcie_probe(struct platform_device *pdev) goto err_pm_put; } + err =clk_prepare_enable (pcie->bus_clk); +if (err) { +dev_err (dev,"failed to enable bus clock: %d\n" , err); + goto err_pm_put; + } + err =rcar_pcie_parse_map_dma_ranges (pcie, dev->of_node);if (err) - goto err_pm_put; + goto err_clk_disable; phy_init_fn =of_device_get_match_data (dev); err =phy_init_fn (pcie);if (err) {dev_err (dev,"failed to init PCIe PHY\n" ); - goto err_pm_put; + goto err_clk_disable; }/* Failure to get a link might just be that no cards are inserted */ if (rcar_pcie_hw_init (pcie)) {dev_info (dev,"PCIe link down\n" ); err = -ENODEV ; - goto err_pm_put; + goto err_clk_disable; } data =rcar_pci_read_reg (pcie,MACSR );@@ -1142,16 +1138,19 @@ static int rcar_pcie_probe(struct platform_device *pdev)dev_err (dev,"failed to enable MSI support: %d\n" , err); - goto err_pm_put; + goto err_clk_disable; } } err =rcar_pcie_enable (pcie);if (err) - goto err_pm_put; + goto err_clk_disable;return 0 ; +err_clk_disable: +clk_disable_unprepare (pcie->bus_clk); + err_pm_put:pm_runtime_put (dev);Signature · 1 line
2.16.2
PATCH v4 2/6 PCI: rcar: Add missing irq_dispose_mapping() into failpath
In reply to Marek VasutThe rcar_pcie_get_resources() is another misnomer with a side effect. The function does not only get resources, but also maps MSI IRQs via irq_of_parse_and_map(). In case anything fails afterward, the IRQ mapping must be disposed through irq_dispose_mapping() which is not done.
This patch handles irq_of_parse_and_map() failures in by disposing of the mapping in rcar_pcie_get_resources() as well as in probe.
---
V2: No change
V3: No change
V4: Rebase on top of Lorenzo's pci/rcar, fix up the rebase breakage
induced by patches therein
--- drivers/pci/host/pcie-rcar.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/pci/host/pcie-rcar.c +14 -3
@@ -950,18 +950,25 @@ static int rcar_pcie_get_resources(struct rcar_pcie *pcie) i =irq_of_parse_and_map (dev->of_node,0 );if (!i) {dev_err (dev,"cannot get platform resources for msi interrupt\n" ); -return -ENOENT ; + err = -ENOENT ; + goto err_irq1; } pcie->msi.irq1 = i; i =irq_of_parse_and_map (dev->of_node,1 );if (!i) {dev_err (dev,"cannot get platform resources for msi interrupt\n" ); -return -ENOENT ; + err = -ENOENT ; + goto err_irq2; } pcie->msi.irq2 = i;return 0 ; + +err_irq2: +irq_dispose_mapping (pcie->msi.irq1); +err_irq1: +return err; } static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
@@ -1108,7 +1115,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) err =clk_prepare_enable (pcie->bus_clk);if (err) {dev_err (dev,"failed to enable bus clock: %d\n" , err); - goto err_pm_put; + goto err_unmap_msi_irqs; } err =rcar_pcie_parse_map_dma_ranges (pcie, dev->of_node);
@@ -1151,6 +1158,10 @@ static int rcar_pcie_probe(struct platform_device *pdev) err_clk_disable:clk_disable_unprepare (pcie->bus_clk); +err_unmap_msi_irqs: +irq_dispose_mapping (pcie->msi.irq2); +irq_dispose_mapping (pcie->msi.irq1); + err_pm_put:pm_runtime_put (dev);
Signature · 1 line
2.16.2
Re: [PATCH v4 2/6] PCI: rcar: Add missing irq_dispose_mapping() into failpath
Quoted 9 lines · Marek Vasut
The
rcar_pcie_get_resources()is another misnomer with a side effect. The function does not only get resources, but also maps MSI IRQs viairq_of_parse_and_map(). In case anything fails afterward, the IRQ mapping must be disposed throughirq_dispose_mapping()which is not done.This patch handles
irq_of_parse_and_map()failures in by disposing of the mapping inrcar_pcie_get_resources()as well as in probe.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>
PATCH v4 3/6 PCI: rcar: Teardown MSI setup if rcar_pcie_enable() fails
In reply to Marek VasutIf the rcar_pcie_enable() fails and MSIs are enabled, the setup done in rcar_pcie_enable_msi() is never undone. Add a function to tear down the MSI setup by disabling the MSI handling in the PCIe block, deallocating the pages requested for the MSIs and zapping the IRQ mapping.
---
V2: No change
V3: No change
V4: Rebase on top of Lorenzo's pci/rcar, fix up the rebase breakage
induced by patches therein
--- drivers/pci/host/pcie-rcar.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/pci/host/pcie-rcar.c +27 -1
@@ -923,6 +923,28 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)return err; } +static void rcar_pcie_teardown_msi (struct rcar_pcie *pcie) +{ +struct rcar_msi *msi = &pcie->msi; +int irq, i; + +/* Disable all MSI interrupts */ +rcar_pci_write_reg (pcie,0 ,PCIEMSIIER ); + +/* Disable address decoding of the MSI interrupt, MSIFE */ +rcar_pci_write_reg (pcie,0 ,PCIEMSIALR ); + +free_pages (msi->pages,0 ); + +for (i =0 ; i <INT_PCI_MSI_NR ; i++) { + irq =irq_find_mapping (msi->domain, i); +if (irq >0 ) +irq_dispose_mapping (irq); + } + +irq_domain_remove (msi->domain); +} +static int rcar_pcie_get_resources (struct rcar_pcie *pcie) {struct device *dev = pcie->dev;
@@ -1151,10 +1173,14 @@ static int rcar_pcie_probe(struct platform_device *pdev) err =rcar_pcie_enable (pcie);if (err) - goto err_clk_disable; + goto err_msi_teardown;return 0 ; +err_msi_teardown: +if (IS_ENABLED (CONFIG_PCI_MSI )) +rcar_pcie_teardown_msi (pcie); + err_clk_disable:clk_disable_unprepare (pcie->bus_clk);
Signature · 1 line
2.16.2
Re: [PATCH v4 3/6] PCI: rcar: Teardown MSI setup if rcar_pcie_enable() fails
Quoted 5 lines · Marek Vasut
If the
rcar_pcie_enable()fails and MSIs are enabled, the setup done inrcar_pcie_enable_msi()is never undone. Add a function to tear down the MSI setup by disabling the MSI handling in the PCIe block, deallocating the pages requested for the MSIs and zapping the IRQ mapping.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>
PATCH v4 4/6 PCI: rcar: Poll more often in rcar_pcie_wait_for_dl()
In reply to Marek VasutThe data link active signal usually takes ~20 uSec to be asserted, poll the bit more often to avoid useless delays in this function. Use udelay() instead of usleep() for such a small delay as suggested by the timer documentation and because this will be used in atomic context later on when the suspend/resume patches land.
---
V2: s/content/context in commit message
V3: Add cpu_relax()
V4: Rebase on top of Lorenzo's pci/rcar, fix up the rebase breakage
induced by patches therein
--- drivers/pci/host/pcie-rcar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/host/pcie-rcar.c +3 -2
@@ -546,13 +546,14 @@ static int rcar_pcie_wait_for_phyrdy(struct rcar_pcie *pcie)static int rcar_pcie_wait_for_dl (struct rcar_pcie *pcie) { -unsigned int timeout =10 ; +unsigned int timeout =10000 ;while (timeout--) {if ((rcar_pci_read_reg (pcie,PCIETSTR ) &DATA_LINK_ACTIVE ))return 0 ; -msleep (5 ); +udelay (5 ); +cpu_relax (); }return -ETIMEDOUT ;
Signature · 1 line
2.16.2
Re: [PATCH v4 4/6] PCI: rcar: Poll more often in rcar_pcie_wait_for_dl()
Quoted 6 lines · Marek Vasut
The data link active signal usually takes ~20 uSec to be asserted, poll the bit more often to avoid useless delays in this function. Use
udelay()instead ofusleep()for such a small delay as suggested by the timer documentation and because this will be used in atomic context later on when the suspend/resume patches land.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>
PATCH v4 5/6 PCI: rcar: Remove IRQ mappings in rcar_pcie_enable_msi failpath
In reply to Marek VasutThe rcar_pcie_enable_msi() creates IRQ mappings using irq_create_mapping() before requesting the IRQs using devm_request_irq(). If devm_request_irq() fails for some reason, rcar_pcie_enable_msi() does not remove the mapping.
Pull out the code for disposing IRQ mappings from rcar_pcie_teardown_msi() into a separate function and call it from both rcar_pcie_teardown_msi() and rcar_pcie_enable_msi() failpath to remove the mappings correctly.
---
V2: No change
V3: No change
V4: Rebase on top of Lorenzo's pci/rcar, fix up the rebase breakage
induced by patches therein
--- drivers/pci/host/pcie-rcar.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
drivers/pci/host/pcie-rcar.c +16 -9
@@ -866,6 +866,20 @@ static const struct irq_domain_ops msi_domain_ops = { .map = rcar_msi_map, }; +static void rcar_pcie_unmap_msi (struct rcar_pcie *pcie) +{ +struct rcar_msi *msi = &pcie->msi; +int i, irq; + +for (i =0 ; i <INT_PCI_MSI_NR ; i++) { + irq =irq_find_mapping (msi->domain, i); +if (irq >0 ) +irq_dispose_mapping (irq); + } + +irq_domain_remove (msi->domain); +} +static int rcar_pcie_enable_msi (struct rcar_pcie *pcie) {struct device *dev = pcie->dev;
@@ -920,14 +934,13 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)return 0 ; err: -irq_domain_remove (msi->domain); +rcar_pcie_unmap_msi (pcie);return err; }static void rcar_pcie_teardown_msi (struct rcar_pcie *pcie) {struct rcar_msi *msi = &pcie->msi; -int irq, i;/* Disable all MSI interrupts */ rcar_pci_write_reg (pcie,0 ,PCIEMSIIER );
@@ -937,13 +950,7 @@ static void rcar_pcie_teardown_msi(struct rcar_pcie *pcie)free_pages (msi->pages,0 ); -for (i =0 ; i <INT_PCI_MSI_NR ; i++) { - irq =irq_find_mapping (msi->domain, i); -if (irq >0 ) -irq_dispose_mapping (irq); - } - -irq_domain_remove (msi->domain); +rcar_pcie_unmap_msi (pcie); }static int rcar_pcie_get_resources (struct rcar_pcie *pcie)
Signature · 1 line
2.16.2
Re: [PATCH v4 5/6] PCI: rcar: Remove IRQ mappings in rcar_pcie_enable_msi failpath
Quoted 8 lines · Marek Vasut
The
rcar_pcie_enable_msi()creates IRQ mappings usingirq_create_mapping()before requesting the IRQs usingdevm_request_irq(). Ifdevm_request_irq()fails for some reason,rcar_pcie_enable_msi()does not remove the mapping.Pull out the code for disposing IRQ mappings from
rcar_pcie_teardown_msi()into a separate function and call it from bothrcar_pcie_teardown_msi()andrcar_pcie_enable_msi()failpath to remove the mappings correctly.
Quoted 8 lines
Signed-off-by Marek Vasut <[email protected]>Reported-by Geert Uytterhoeven <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>
PATCH v4 6/6 PCI: rcar: Shut the PHY down in failpath
In reply to Marek VasutIf anything fails past phy_init_fn() and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by the phy_init_fn, which is in fact a pointer to rcar_pcie_phy_init_gen3() function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart.
---
V4: New patch
--- drivers/pci/host/pcie-rcar.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/host/pcie-rcar.c +8 -2
@@ -1163,7 +1163,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)if (rcar_pcie_hw_init (pcie)) {dev_info (dev,"PCIe link down\n" ); err = -ENODEV ; - goto err_clk_disable; + goto err_phy_shutdown; } data =rcar_pci_read_reg (pcie,MACSR );
@@ -1175,7 +1175,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)dev_err (dev,"failed to enable MSI support: %d\n" , err); - goto err_clk_disable; + goto err_phy_shutdown; } }
@@ -1189,6 +1189,12 @@ static int rcar_pcie_probe(struct platform_device *pdev)if (IS_ENABLED (CONFIG_PCI_MSI ))rcar_pcie_teardown_msi (pcie); +err_phy_shutdown: +if (pcie->phy) { +phy_power_off (pcie->phy); +phy_exit (pcie->phy); + } + err_clk_disable:clk_disable_unprepare (pcie->bus_clk);
Signature · 1 line
2.16.2
Re: [PATCH v4 6/6] PCI: rcar: Shut the PHY down in failpath
Quoted 7 lines · Marek Vasut
If anything fails past
phy_init_fn()and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by thephy_init_fn, which is in fact a pointer torcar_pcie_phy_init_gen3()function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart.Signed-off-by Marek Vasut <[email protected]>
Note that there's another unhandled failure mode: rcar_pcie_phy_init_gen3() doesn't call phy_exit() if phy_power_on() fails.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v4 6/6] PCI: rcar: Shut the PHY down in failpath
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · Marek Vasut
If anything fails past
phy_init_fn()and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by thephy_init_fn, which is in fact a pointer torcar_pcie_phy_init_gen3()function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart.
Quoted 6 lines
Quoted 1 line
Signed-off-by Marek Vasut <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>Note that there's another unhandled failure mode:
rcar_pcie_phy_init_gen3()doesn't callphy_exit()ifphy_power_on()fails.
Should be fixed by subsequent patch, thanks.
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH v4 6/6] PCI: rcar: Shut the PHY down in failpath
In reply to Marek VasutQuoted 6 lines · Marek Vasut
If anything fails past
phy_init_fn()and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by thephy_init_fn, which is in fact a pointer torcar_pcie_phy_init_gen3()function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart.
Quoted 8 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>Fixes 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")
Quoted 44 lines
---
V4: New patch--- drivers/pci/host/pcie-rcar.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/pci/host/pcie-rcar.c +8
-2@@ -1163,7 +1163,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)if (rcar_pcie_hw_init (pcie)) {dev_info (dev,"PCIe link down\n" ); err = -ENODEV ; - goto err_clk_disable; + goto err_phy_shutdown; } data =rcar_pci_read_reg (pcie,MACSR );@@ -1175,7 +1175,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)dev_err (dev,"failed to enable MSI support: %d\n" , err); - goto err_clk_disable; + goto err_phy_shutdown; } }@@ -1189,6 +1189,12 @@ static int rcar_pcie_probe(struct platform_device *pdev)if (IS_ENABLED (CONFIG_PCI_MSI ))rcar_pcie_teardown_msi (pcie); +err_phy_shutdown: +if (pcie->phy) { +phy_power_off (pcie->phy); +phy_exit (pcie->phy); + } + err_clk_disable:clk_disable_unprepare (pcie->bus_clk);Signature · 1 line
2.16.2
Re: [PATCH v4 6/6] PCI: rcar: Shut the PHY down in failpath
Quoted 16 lines · Simon Horman
Quoted 6 lines · Marek Vasut
If anything fails past
phy_init_fn()and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by thephy_init_fn, which is in fact a pointer torcar_pcie_phy_init_gen3()function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart.Quoted 8 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>Fixes 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")
Quoted 1 line
Acked-by Simon Horman <[email protected]>
While I see the first 5 in today's next, I don't see this one there, so it'd be nice to add it too.
Signature · 2 lines
Best regards, Marek Vasut
Lorenzo Pieralisi
AppliedRe: [PATCH v4 6/6] PCI: rcar: Shut the PHY down in failpath
In reply to Marek VasutQuoted 14 lines · Marek Vasut
If anything fails past
phy_init_fn()and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by thephy_init_fn, which is in fact a pointer torcar_pcie_phy_init_gen3()function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart.Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>Fixes 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")
Quoted 5 lines
---
V4: New patch--- drivers/pci/host/pcie-rcar.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Applied to pci/controller-fixes to be tentatively merged at -rc4, thanks.
Lorenzo
Quoted 38 lines
drivers/pci/host/pcie-rcar.c +8
-2@@ -1163,7 +1163,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)if (rcar_pcie_hw_init (pcie)) {dev_info (dev,"PCIe link down\n" ); err = -ENODEV ; - goto err_clk_disable; + goto err_phy_shutdown; } data =rcar_pci_read_reg (pcie,MACSR );@@ -1175,7 +1175,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)dev_err (dev,"failed to enable MSI support: %d\n" , err); - goto err_clk_disable; + goto err_phy_shutdown; } }@@ -1189,6 +1189,12 @@ static int rcar_pcie_probe(struct platform_device *pdev)if (IS_ENABLED (CONFIG_PCI_MSI ))rcar_pcie_teardown_msi (pcie); +err_phy_shutdown: +if (pcie->phy) { +phy_power_off (pcie->phy); +phy_exit (pcie->phy); + } + err_clk_disable:clk_disable_unprepare (pcie->bus_clk);Signature · 1 line
2.16.2
Geert, Simon,
Can I retain your review tags on this series so that I can queue the patches ? I already added them apart from the last patch that is new, please let me know asap.
Thanks,
Lorenzo
Quoted 29 lines · Marek Vasut
Multiple minor failpath fixes for the R-Car PCIe driver.
V4: Sync up the version numbers
Rebase on top of Lorenzo's tree
Add new patch fixing bug in the PHY codeMarek Vasut (6):
PCI: rcar: Pull bus clock enable/disable from
rcar_pcie_get_resources()
PCI: rcar: Add missingirq_dispose_mapping()into failpath
PCI: rcar: Teardown MSI setup ifrcar_pcie_enable()fails
PCI: rcar: Poll more often inrcar_pcie_wait_for_dl()
PCI: rcar: Remove IRQ mappings inrcar_pcie_enable_msifailpath
PCI: rcar: Shut the PHY down in failpathdrivers/pci/host/pcie-rcar.c | 82 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 16 deletions(-)Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>Signature · 1 line
2.16.2
Hi Lorenzo,
Quoted 3 lines · Lorenzo Pieralisi
Can I retain your review tags on this series so that I can queue the patches ? I already added them apart from the last patch that is new, please let me know asap.
Yes, please.
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 9 lines · Geert Uytterhoeven
Hi Lorenzo,
Quoted 3 lines · Lorenzo Pieralisi
Can I retain your review tags on this series so that I can queue the patches ? I already added them apart from the last patch that is new, please let me know asap.
Yes, please.
I assume that's valid also for the last patch, I need Simon's ACK to proceed too.
Lorenzo
Hi Lorenzo,
Quoted 11 lines · Lorenzo Pieralisi
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Lorenzo Pieralisi
Can I retain your review tags on this series so that I can queue the patches ? I already added them apart from the last patch that is new, please let me know asap.
Yes, please.
I assume that's valid also for the last patch, I need Simon's ACK to proceed too.
I haven't reviewed the last patch yet.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 15 lines · Marek Vasut
Multiple minor failpath fixes for the R-Car PCIe driver.
V4: Sync up the version numbers
Rebase on top of Lorenzo's tree
Add new patch fixing bug in the PHY codeMarek Vasut (6):
PCI: rcar: Pull bus clock enable/disable from
rcar_pcie_get_resources()
PCI: rcar: Add missingirq_dispose_mapping()into failpath
PCI: rcar: Teardown MSI setup ifrcar_pcie_enable()fails
PCI: rcar: Poll more often inrcar_pcie_wait_for_dl()
PCI: rcar: Remove IRQ mappings inrcar_pcie_enable_msifailpath
PCI: rcar: Shut the PHY down in failpath
Quoted 2 lines
drivers/pci/host/pcie-rcar.c | 82 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 16 deletions(-)
Marek,
I have applied patches [1-5] to pci/rcar for v4.18, I could not apply patch 6 since it is missing Simon's ACK (please have a look at what I queued to check it is OK).
Bjorn will be merging the branch into -next shortly, I do not know if there is room for adding additional patches on top of it, as I mentioned on linux-pci I will be offline for two weeks so it is possible that what's in pci/rcar at present will be what gets into v4.18, apologies, that's all I can do.
Lorenzo
Quoted 11 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>Signature · 1 line
2.16.2
Quoted 25 lines · Lorenzo Pieralisi
Quoted 15 lines · Marek Vasut
Multiple minor failpath fixes for the R-Car PCIe driver.
V4: Sync up the version numbers
Rebase on top of Lorenzo's tree
Add new patch fixing bug in the PHY codeMarek Vasut (6):
PCI: rcar: Pull bus clock enable/disable from
rcar_pcie_get_resources()
PCI: rcar: Add missingirq_dispose_mapping()into failpath
PCI: rcar: Teardown MSI setup ifrcar_pcie_enable()fails
PCI: rcar: Poll more often inrcar_pcie_wait_for_dl()
PCI: rcar: Remove IRQ mappings inrcar_pcie_enable_msifailpath
PCI: rcar: Shut the PHY down in failpathQuoted 2 lines
drivers/pci/host/pcie-rcar.c | 82 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 16 deletions(-)Marek,
I have applied patches [1-5] to pci/rcar for v4.18, I could not apply patch 6 since it is missing Simon's ACK (please have a look at what I queued to check it is OK).
Quoted 5 lines
Bjorn will be merging the branch into -next shortly, I do not know if there is room for adding additional patches on top of it, as I mentioned on linux-pci I will be offline for two weeks so it is possible that what's in pci/rcar at present will be what gets into v4.18, apologies, that's all I can do.
Fine. Yes, there's another patch coming for the PHY stuff from Sergej.
Signature · 2 lines
Best regards, Marek Vasut
Simon Horman
Acked-byQuoted 16 lines · Lorenzo Pieralisi
Quoted 15 lines · Marek Vasut
Multiple minor failpath fixes for the R-Car PCIe driver.
V4: Sync up the version numbers
Rebase on top of Lorenzo's tree
Add new patch fixing bug in the PHY codeMarek Vasut (6):
PCI: rcar: Pull bus clock enable/disable from
rcar_pcie_get_resources()
PCI: rcar: Add missingirq_dispose_mapping()into failpath
PCI: rcar: Teardown MSI setup ifrcar_pcie_enable()fails
PCI: rcar: Poll more often inrcar_pcie_wait_for_dl()
PCI: rcar: Remove IRQ mappings inrcar_pcie_enable_msifailpath
PCI: rcar: Shut the PHY down in failpath
Quoted 8 lines
Quoted 2 lines
drivers/pci/host/pcie-rcar.c | 82 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 16 deletions(-)Marek,
I have applied patches [1-5] to pci/rcar for v4.18, I could not apply patch 6 since it is missing Simon's ACK (please have a look at what I queued to check it is OK).
Sorry for the delay. You should have that now.
If not, for the entire series:
Quoted 6 lines
Bjorn will be merging the branch into -next shortly, I do not know if there is room for adding additional patches on top of it, as I mentioned on linux-pci I will be offline for two weeks so it is possible that what's in pci/rcar at present will be what gets into v4.18, apologies, that's all I can do.