All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller
@ 2017-06-29  1:21 ` Shawn Lin
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-06-29  1:21 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring
  Cc: linux-pci-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Shawn Lin

PCIe connector provide a optional 12V power supply for high
power downstream components, so we add this as a optional
one if we need to control it.

Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---

 Documentation/devicetree/bindings/pci/rockchip-pcie.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
index 1453a73..9b88959 100644
--- a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
@@ -47,6 +47,7 @@ Optional Property:
 	using 24MHz OSC for RC's PHY.
 - ep-gpios: contain the entry for pre-reset gpio
 - num-lanes: number of lanes to use
+- vpcie12v-supply: The phandle to the 12v regulator to use for PCIe.
 - vpcie3v3-supply: The phandle to the 3.3v regulator to use for PCIe.
 - vpcie1v8-supply: The phandle to the 1.8v regulator to use for PCIe.
 - vpcie0v9-supply: The phandle to the 0.9v regulator to use for PCIe.
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/3] dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller
@ 2017-06-29  1:21 ` Shawn Lin
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-06-29  1:21 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring
  Cc: linux-pci, linux-rockchip, devicetree, Shawn Lin

PCIe connector provide a optional 12V power supply for high
power downstream components, so we add this as a optional
one if we need to control it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 Documentation/devicetree/bindings/pci/rockchip-pcie.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
index 1453a73..9b88959 100644
--- a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
@@ -47,6 +47,7 @@ Optional Property:
 	using 24MHz OSC for RC's PHY.
 - ep-gpios: contain the entry for pre-reset gpio
 - num-lanes: number of lanes to use
+- vpcie12v-supply: The phandle to the 12v regulator to use for PCIe.
 - vpcie3v3-supply: The phandle to the 3.3v regulator to use for PCIe.
 - vpcie1v8-supply: The phandle to the 1.8v regulator to use for PCIe.
 - vpcie0v9-supply: The phandle to the 0.9v regulator to use for PCIe.
-- 
1.9.1

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

* [PATCH 2/3] PCI: rockchip: control optional 12v power supply
  2017-06-29  1:21 ` Shawn Lin
  (?)
@ 2017-06-29  1:22 ` Shawn Lin
  -1 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-06-29  1:22 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-rockchip, Shawn Lin

This patch is trying to get vpcie12v from DT and control
it if available.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/pci/host/pcie-rockchip.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 199edd5..c545213 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -221,6 +221,7 @@ struct rockchip_pcie {
 	struct	clk *aclk_perf_pcie;
 	struct	clk *hclk_pcie;
 	struct	clk *clk_pcie_pm;
+	struct	regulator *vpcie12v; /* 12V power supply */
 	struct	regulator *vpcie3v3; /* 3.3V power supply */
 	struct	regulator *vpcie1v8; /* 1.8V power supply */
 	struct	regulator *vpcie0v9; /* 0.9V power supply */
@@ -1013,6 +1014,13 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip)
 		return err;
 	}
 
+	rockchip->vpcie12v = devm_regulator_get_optional(dev, "vpcie12v");
+	if (IS_ERR(rockchip->vpcie12v)) {
+		if (PTR_ERR(rockchip->vpcie12v) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		dev_info(dev, "no vpcie12v regulator found\n");
+	}
+
 	rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
 	if (IS_ERR(rockchip->vpcie3v3)) {
 		if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER)
@@ -1042,11 +1050,19 @@ static int rockchip_pcie_set_vpcie(struct rockchip_pcie *rockchip)
 	struct device *dev = rockchip->dev;
 	int err;
 
+	if (!IS_ERR(rockchip->vpcie12v)) {
+		err = regulator_enable(rockchip->vpcie12v);
+		if (err) {
+			dev_err(dev, "fail to enable vpcie12v regulator\n");
+			goto err_out;
+		}
+	}
+
 	if (!IS_ERR(rockchip->vpcie3v3)) {
 		err = regulator_enable(rockchip->vpcie3v3);
 		if (err) {
 			dev_err(dev, "fail to enable vpcie3v3 regulator\n");
-			goto err_out;
+			goto err_disable_12v;
 		}
 	}
 
@@ -1074,6 +1090,9 @@ static int rockchip_pcie_set_vpcie(struct rockchip_pcie *rockchip)
 err_disable_3v3:
 	if (!IS_ERR(rockchip->vpcie3v3))
 		regulator_disable(rockchip->vpcie3v3);
+err_disable_12v:
+	if (!IS_ERR(rockchip->vpcie12v))
+		regulator_disable(rockchip->vpcie12v);
 err_out:
 	return err;
 }
@@ -1497,6 +1516,8 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
 err_free_res:
 	pci_free_resource_list(&res);
 err_vpcie:
+	if (!IS_ERR(rockchip->vpcie12v))
+		regulator_disable(rockchip->vpcie12v);
 	if (!IS_ERR(rockchip->vpcie3v3))
 		regulator_disable(rockchip->vpcie3v3);
 	if (!IS_ERR(rockchip->vpcie1v8))
@@ -1533,6 +1554,8 @@ static int rockchip_pcie_remove(struct platform_device *pdev)
 	clk_disable_unprepare(rockchip->aclk_perf_pcie);
 	clk_disable_unprepare(rockchip->aclk_pcie);
 
+	if (!IS_ERR(rockchip->vpcie12v))
+		regulator_disable(rockchip->vpcie12v);
 	if (!IS_ERR(rockchip->vpcie3v3))
 		regulator_disable(rockchip->vpcie3v3);
 	if (!IS_ERR(rockchip->vpcie1v8))
-- 
1.9.1

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

* [PATCH 3/3] PCI: rockchip: use local variable dev consistently
  2017-06-29  1:21 ` Shawn Lin
  (?)
  (?)
@ 2017-06-29  1:22 ` Shawn Lin
  2017-07-02 21:30   ` Bjorn Helgaas
  -1 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2017-06-29  1:22 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-rockchip, Shawn Lin

We have "struct device *dev" in rockchip_pcie_probe but
still fetch it from pdev and rockchip->dev somewhere.
This patch tries to improve and no functional change intended.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/pci/host/pcie-rockchip.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index c545213..eb0a170 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -1482,15 +1482,14 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
 	if (err)
 		goto err_free_res;
 
-	rockchip->msg_region = devm_ioremap(rockchip->dev,
-					    rockchip->msg_bus_addr, SZ_1M);
+	rockchip->msg_region = devm_ioremap(dev, rockchip->msg_bus_addr, SZ_1M);
 	if (!rockchip->msg_region) {
 		err = -ENOMEM;
 		goto err_free_res;
 	}
 
 	list_splice_init(&res, &bridge->windows);
-	bridge->dev.parent = &pdev->dev;
+	bridge->dev.parent = dev;
 	bridge->sysdata = rockchip;
 	bridge->busnr = 0;
 	bridge->ops = &rockchip_pcie_ops;
-- 
1.9.1

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

* Re: [PATCH 3/3] PCI: rockchip: use local variable dev consistently
  2017-06-29  1:22 ` [PATCH 3/3] PCI: rockchip: use local variable dev consistently Shawn Lin
@ 2017-07-02 21:30   ` Bjorn Helgaas
  2017-07-07  0:40     ` Shawn Lin
  0 siblings, 1 reply; 9+ messages in thread
From: Bjorn Helgaas @ 2017-07-02 21:30 UTC (permalink / raw)
  To: Shawn Lin; +Cc: Bjorn Helgaas, linux-pci, linux-rockchip

On Thu, Jun 29, 2017 at 09:22:49AM +0800, Shawn Lin wrote:
> We have "struct device *dev" in rockchip_pcie_probe but
> still fetch it from pdev and rockchip->dev somewhere.
> This patch tries to improve and no functional change intended.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Applied to pci/host-rockchip for v4.13, thanks!

I don't object to patches 1 & 2, but haven't applied them yet in case Rob
has any comments.

> ---
> 
>  drivers/pci/host/pcie-rockchip.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index c545213..eb0a170 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -1482,15 +1482,14 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
>  	if (err)
>  		goto err_free_res;
>  
> -	rockchip->msg_region = devm_ioremap(rockchip->dev,
> -					    rockchip->msg_bus_addr, SZ_1M);
> +	rockchip->msg_region = devm_ioremap(dev, rockchip->msg_bus_addr, SZ_1M);
>  	if (!rockchip->msg_region) {
>  		err = -ENOMEM;
>  		goto err_free_res;
>  	}
>  
>  	list_splice_init(&res, &bridge->windows);
> -	bridge->dev.parent = &pdev->dev;
> +	bridge->dev.parent = dev;
>  	bridge->sysdata = rockchip;
>  	bridge->busnr = 0;
>  	bridge->ops = &rockchip_pcie_ops;
> -- 
> 1.9.1
> 
> 

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

* Re: [PATCH 1/3] dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller
  2017-06-29  1:21 ` Shawn Lin
                   ` (2 preceding siblings ...)
  (?)
@ 2017-07-06 14:39 ` Rob Herring
  -1 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2017-07-06 14:39 UTC (permalink / raw)
  To: Shawn Lin; +Cc: Bjorn Helgaas, linux-pci, linux-rockchip, devicetree

On Thu, Jun 29, 2017 at 09:21:28AM +0800, Shawn Lin wrote:
> PCIe connector provide a optional 12V power supply for high
> power downstream components, so we add this as a optional
> one if we need to control it.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  Documentation/devicetree/bindings/pci/rockchip-pcie.txt | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 3/3] PCI: rockchip: use local variable dev consistently
  2017-07-02 21:30   ` Bjorn Helgaas
@ 2017-07-07  0:40     ` Shawn Lin
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-07-07  0:40 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: shawn.lin, Bjorn Helgaas, linux-pci, linux-rockchip

Hi Bjorn,

On 2017/7/3 5:30, Bjorn Helgaas wrote:
> On Thu, Jun 29, 2017 at 09:22:49AM +0800, Shawn Lin wrote:
>> We have "struct device *dev" in rockchip_pcie_probe but
>> still fetch it from pdev and rockchip->dev somewhere.
>> This patch tries to improve and no functional change intended.
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> 
> Applied to pci/host-rockchip for v4.13, thanks!
> 
> I don't object to patches 1 & 2, but haven't applied them yet in case Rob
> has any comments.

It's possible for patches 1 & 2 to be the candidate of v4.13 at the last
minute? :)

> 
>> ---
>>
>>   drivers/pci/host/pcie-rockchip.c | 5 ++---
>>   1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
>> index c545213..eb0a170 100644
>> --- a/drivers/pci/host/pcie-rockchip.c
>> +++ b/drivers/pci/host/pcie-rockchip.c
>> @@ -1482,15 +1482,14 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
>>   	if (err)
>>   		goto err_free_res;
>>   
>> -	rockchip->msg_region = devm_ioremap(rockchip->dev,
>> -					    rockchip->msg_bus_addr, SZ_1M);
>> +	rockchip->msg_region = devm_ioremap(dev, rockchip->msg_bus_addr, SZ_1M);
>>   	if (!rockchip->msg_region) {
>>   		err = -ENOMEM;
>>   		goto err_free_res;
>>   	}
>>   
>>   	list_splice_init(&res, &bridge->windows);
>> -	bridge->dev.parent = &pdev->dev;
>> +	bridge->dev.parent = dev;
>>   	bridge->sysdata = rockchip;
>>   	bridge->busnr = 0;
>>   	bridge->ops = &rockchip_pcie_ops;
>> -- 
>> 1.9.1
>>
>>
> 
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
> 
> 
> 

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

* Re: [PATCH 1/3] dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller
  2017-06-29  1:21 ` Shawn Lin
@ 2017-07-10 20:44     ` Bjorn Helgaas
  -1 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2017-07-10 20:44 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Bjorn Helgaas, Rob Herring, linux-pci-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, Jun 29, 2017 at 09:21:28AM +0800, Shawn Lin wrote:
> PCIe connector provide a optional 12V power supply for high
> power downstream components, so we add this as a optional
> one if we need to control it.
> 
> Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

Applied patches 1 & 2 with Rob's ack to pci/host-rockchip for v4.14,
thanks!

> ---
> 
>  Documentation/devicetree/bindings/pci/rockchip-pcie.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
> index 1453a73..9b88959 100644
> --- a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
> @@ -47,6 +47,7 @@ Optional Property:
>  	using 24MHz OSC for RC's PHY.
>  - ep-gpios: contain the entry for pre-reset gpio
>  - num-lanes: number of lanes to use
> +- vpcie12v-supply: The phandle to the 12v regulator to use for PCIe.
>  - vpcie3v3-supply: The phandle to the 3.3v regulator to use for PCIe.
>  - vpcie1v8-supply: The phandle to the 1.8v regulator to use for PCIe.
>  - vpcie0v9-supply: The phandle to the 0.9v regulator to use for PCIe.
> -- 
> 1.9.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/3] dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller
@ 2017-07-10 20:44     ` Bjorn Helgaas
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2017-07-10 20:44 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Bjorn Helgaas, Rob Herring, linux-pci, linux-rockchip, devicetree

On Thu, Jun 29, 2017 at 09:21:28AM +0800, Shawn Lin wrote:
> PCIe connector provide a optional 12V power supply for high
> power downstream components, so we add this as a optional
> one if we need to control it.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Applied patches 1 & 2 with Rob's ack to pci/host-rockchip for v4.14,
thanks!

> ---
> 
>  Documentation/devicetree/bindings/pci/rockchip-pcie.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
> index 1453a73..9b88959 100644
> --- a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
> @@ -47,6 +47,7 @@ Optional Property:
>  	using 24MHz OSC for RC's PHY.
>  - ep-gpios: contain the entry for pre-reset gpio
>  - num-lanes: number of lanes to use
> +- vpcie12v-supply: The phandle to the 12v regulator to use for PCIe.
>  - vpcie3v3-supply: The phandle to the 3.3v regulator to use for PCIe.
>  - vpcie1v8-supply: The phandle to the 1.8v regulator to use for PCIe.
>  - vpcie0v9-supply: The phandle to the 0.9v regulator to use for PCIe.
> -- 
> 1.9.1
> 
> 

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

end of thread, other threads:[~2017-07-10 20:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29  1:21 [PATCH 1/3] dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller Shawn Lin
2017-06-29  1:21 ` Shawn Lin
2017-06-29  1:22 ` [PATCH 2/3] PCI: rockchip: control optional 12v power supply Shawn Lin
2017-06-29  1:22 ` [PATCH 3/3] PCI: rockchip: use local variable dev consistently Shawn Lin
2017-07-02 21:30   ` Bjorn Helgaas
2017-07-07  0:40     ` Shawn Lin
2017-07-06 14:39 ` [PATCH 1/3] dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller Rob Herring
     [not found] ` <1498699288-63944-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-07-10 20:44   ` Bjorn Helgaas
2017-07-10 20:44     ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.