Skip to contentSkip to conversation

ARM: tegra30: clocks: Fix pciex clock registration

PATCH Superseded Jay Agarwal 5 participants 17 messages Jun 4, 2013 – Jul 17, 2013

Subsystems (7)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 ARM: tegra30: clocks: Fix pciex clock registration

Registering pciex as peripheral clock instead of fixed clock as tegra_perih_reset_assert(deassert) api of this clock api gives warning and ultimately does not succeed to assert(deassert).

---
Patch is based on remotes/gitorious_thierryreding_linux/tegra/next and should be applied on top of this.

Changes in V3:
- Avoid removing pciex duplicate clock as per review comment
- Corrected tegra pcie driver name for duplicate clocks

 drivers/clk/tegra/clk-tegra30.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
drivers/clk/tegra/clk-tegra30.c +8 -7
index c6921f5..edb2b9b 100644
@@ -1598,6 +1598,12 @@ static void __init tegra30_periph_clk_init(void)
 	clk_register_clkdev(clk, "afi", "tegra-pcie");
 	clks[afi] = clk;
 
+	/* pciex */
+	clk = tegra_clk_register_periph_gate("pciex", "pll_e", 0, clk_base, 0,
+				    74, &periph_u_regs, periph_clk_enb_refcnt);
+	clk_register_clkdev(clk, "pciex", "tegra-pcie");
+	clks[pciex] = clk;
+
 	/* kfuse */
 	clk = tegra_clk_register_periph_gate("kfuse", "clk_m",
 				    TEGRA_PERIPH_ON_APB,
@@ -1716,11 +1722,6 @@ static void __init tegra30_fixed_clk_init(void)
 				1, 0, &cml_lock);
 	clk_register_clkdev(clk, "cml1", NULL);
 	clks[cml1] = clk;
-
-	/* pciex */
-	clk = clk_register_fixed_rate(NULL, "pciex", "pll_e", 0, 100000000);
-	clk_register_clkdev(clk, "pciex", NULL);
-	clks[pciex] = clk;
 }
 
 static void __init tegra30_osc_clk_init(void)
@@ -1942,8 +1943,8 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
 	TEGRA_CLK_DUPLICATE(bsea, "tegra-aes", "bsea"),
 	TEGRA_CLK_DUPLICATE(bsea, "nvavp", "bsea"),
 	TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL),
-	TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"),
-	TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"),
+	TEGRA_CLK_DUPLICATE(cml0, "tegra-pcie", "cml"),
+	TEGRA_CLK_DUPLICATE(pciex, "tegra-pcie", "pciex"),
 	TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"),
 	TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */
 };
Signature · 1 line
1.7.0.4
#8 lore raw

PATCH v3 3/4 ARM: dts: tegra: Correct PCIe entry

- Add interrupt-names property
- Correct downstream I/O size

---
Patch is based on remotes/gitorious_thierryreding_linux/tegra/next and should be applied on top of this.

Changes in V3:
- Avoided changes in cml clock as per review comment

 arch/arm/boot/dts/tegra30.dtsi |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/tegra30.dtsi +2 -2
index a242b2e..a301389 100644
@@ -21,7 +21,7 @@
 		reg-names = "pads", "afi", "cs";
 		interrupts = <0 98 0x04   /* controller interrupt */
 		              0 99 0x04>; /* MSI interrupt */
-
+		interrupt-names = "intr", "msi";
 		bus-range = <0x00 0xff>;
 		#address-cells = <3>;
 		#size-cells = <2>;
@@ -29,7 +29,7 @@
 		ranges = <0x82000000 0 0x00000000 0x00000000 0 0x00001000   /* port 0 configuration space */
 			  0x82000000 0 0x00001000 0x00001000 0 0x00001000   /* port 1 configuration space */
 			  0x82000000 0 0x00004000 0x00004000 0 0x00001000   /* port 2 configuration space */
-			  0x81000000 0 0          0x02000000 0 0x00010000   /* downstream I/O */
+			  0x81000000 0 0          0x02000000 0 0x00100000   /* downstream I/O */
 			  0x82000000 0 0x20000000 0x20000000 0 0x10000000   /* non-prefetchable memory */
 			  0xc2000000 0 0x30000000 0x30000000 0 0x10000000>; /* prefetchable memory */
 
Signature · 1 line
1.7.0.4
#13 lore raw

PATCH v3 4/4 ARM: tegra: pcie: Enable PCIe controller on Cardhu

In reply to Jay Agarwal

- Enable PCIe controller on Cardhu
- Only port 2 is connected on this board
- Add regulators required for Tegra30

---
Patch is based on remotes/gitorious_thierryreding_linux/tegra/next and should be applied on top of this.

Changes in V3:
- Added num-lanes property for cardhu as per review comments

 arch/arm/boot/dts/tegra30-cardhu.dtsi |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra30-cardhu.dtsi +18 -0
index 8ad4841..b6270e3 100644
@@ -27,6 +27,24 @@
 	model = "NVIDIA Tegra30 Cardhu evaluation board";
 	compatible = "nvidia,cardhu", "nvidia,tegra30";
 
+	pcie-controller {
+		status = "okay";
+		pex-clk-supply = <&pex_hvdd_3v3_reg>;
+		vdd-supply = <&ldo1_reg>;
+		avdd-supply = <&ldo2_reg>;
+
+		pci@1,0 {
+			nvidia,num-lanes = <4>;
+		};
+		pci@2,0 {
+			nvidia,num-lanes = <1>;
+		};
+		pci@3,0 {
+			status = "okay";
+			nvidia,num-lanes = <1>;
+		};
+	};
+
 	host1x {
 		dc@54200000 {
 			rgb {
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v3 2/4 ARM: tegra: pcie: Add tegra3 support

In reply to Jay Agarwal

- Enable PCIe root port 2 for Cardhu
- Make private data structure for each SoC
- Add required Tegra30 clocks and regulators
- Add Tegra30 specific code in enable controller
- Corrected logic in read/write config space to
display right device number on bus 0
- Fixed unnecessary freeing of tegra_pcie_bus structure in tegra_pcie_remove
- Added Tegra30 specific properties in pci binding document

---
Patch is based on remotes/gitorious_thierryreding_linux/tegra/next and should be applied on top of this.

Changes in V3:
- Added entry in required properties in pci document as per review comment
- Corrected logic in read/write config space to display right device number on bus 0
- Fixed unnecessary freeing of tegra_pcie_bus structure in tegra_pcie_remove
- Took care of other review comments to change data types and names of some members of tegra_pcie_soc_data structure

 .../bindings/pci/nvidia,tegra20-pcie.txt           |    2 +
 drivers/pci/host/pci-tegra.c                       |  157 ++++++++++++++++----
 2 files changed, 133 insertions(+), 26 deletions(-)
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +2 -0
index 90c112f..4ac22ab 100644
@@ -16,6 +16,7 @@ Required properties:
   "msi": The Tegra interrupt that is asserted when an MSI is received
 - pex-clk-supply: Supply voltage for internal reference clock
 - vdd-supply: Power supply for controller (1.05V)
+- avdd-supply: Power supply for controller (1.05V)
 - bus-range: Range of bus numbers associated with this controller
 - #address-cells: Address representation for root ports (must be 3)
   - cell 0 specifies the bus and device numbers of the root port:
@@ -48,6 +49,7 @@ Required properties:
   "afi": The Tegra clock of that name
   "pcie_xclk": The Tegra clock of that name
   "pll_e": The Tegra clock of that name
+  "cml": The Tegra clock of that name
 
 Root ports are defined as subnodes of the PCIe controller node.
 
drivers/pci/host/pci-tegra.c +131 -26

391 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#14 lore raw
In reply to Jay Agarwal
Quoted 7 lines · Jay Agarwal

Registering pciex as peripheral clock instead of fixed clock as tegra_perih_reset_assert(deassert) api of this clock api gives warning and ultimately does not succeed to assert(deassert).

---
Patch is based on remotes/gitorious_thierryreding_linux/tegra/next and should be applied on top of this.

For this change, Mike may as well apply it directly to the clock tree. Thierry can then pick it up when he rebases his tegra/next tree.

That said, I don't think you should need any of the TEGRA_CLK_DUPLICATE() entries; the PCIe driver should get its clocks from device tree now, and hence the driver name in the clock registration shouldn't be necessary. All of these TEGRA_CLK_DUPLICATE() entries should be removed en mass sometime soon with luck. So, can you simply leave the two TEGRA_CLK_DUPLICATE() entries untouched, rather than changing them?

#2 lore raw

Re: [PATCH V3 2/4] ARM: tegra: pcie: Add tegra3 support

In reply to Jay Agarwal
Quoted 10 lines · Jay Agarwal

- Enable PCIe root port 2 for Cardhu
- Make private data structure for each SoC
- Add required Tegra30 clocks and regulators
- Add Tegra30 specific code in enable controller
- Corrected logic in read/write config space to
display right device number on bus 0
- Fixed unnecessary freeing of tegra_pcie_bus structure in tegra_pcie_remove
- Added Tegra30 specific properties in pci binding document

Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt

Quoted 4 lines
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +2 -0
 
+- avdd-supply: Power supply for controller (1.05V)
 
+  "cml": The Tegra clock of that name

Both those changes need to mention that those additions are only required for Tegra30, not Tegra20. In other words,

+- avdd-supply: Power supply for controller (1.05V) (not required for Tegra20)

+ "cml": The Tegra clock of that name (not required for Tegra20)

You probably also want to explicitly mention nvidia,tegra30-pcie as a legal compatible value.

drivers/pci/host/pci-tegra.c struct tegra_msi { · line 207

Quoted 5 lines
drivers/pci/host/pci-tegra.c +3 -0
 
+/* used to differentiate tegra chips code */
+struct tegra_pcie_soc_data {
+	unsigned int num_max_ports;

nit: "num max" seems redundant. max_ports or num_ports would be better.

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, · line 411

Quoted 7 lines

struct tegra_pcie_port {

drivers/pci/host/pci-tegra.c +1 -1
@@ -384,7 +408,7 @@ static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
 		struct tegra_pcie_port *port;
 
 		list_for_each_entry(port, &pcie->ports, list) {
-			if (port->index + 1 == slot) {
+			if (port->index == slot) {

This and the equivalent change in tegra_pcie_write_conf() seem like a bug-fix unrelated to the addition of Tegra30 support. Hence, they should be a separate patch.

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, · line 425

Quoted 6 lines
drivers/pci/host/pci-tegra.c +0 -1
@@ -398,7 +422,6 @@ static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
 			*value = 0xffffffff;
 			return PCIBIOS_DEVICE_NOT_FOUND;
 		}
-
 		addr += tegra_pcie_conf_offset(devfn, where);

Unnecessary white-space change.

drivers/pci/host/pci-tegra.c static int tegra_pcie_remove(struct platform_device *pdev) · line 1665

Quoted 10 lines
drivers/pci/host/pci-tegra.c +2 -3
@@ -1549,10 +1660,9 @@ static int tegra_pcie_remove(struct platform_device *pdev)
 	struct tegra_pcie_bus *bus;
 	int err;
 
-	list_for_each_entry(bus, &pcie->busses, list) {
+	list_for_each_entry(bus, &pcie->busses, list)
 		vunmap(bus->area->addr);
-		kfree(bus);
-	}
+	kfree(bus);

This doesn't look right. Can you please explain it further? This is looping over every bus in a dynamic list, so surely each entry needs to be freed? Did you do this to avoid a crash? If so, the issue is likely that the loop should use list_for_each_entry_safe() rather than list_for_each_entry().

#3 lore raw

RE: [PATCH V3 2/4] ARM: tegra: pcie: Add tegra3 support

Quoted 57 lines
Quoted 7 lines

diff --git a/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt b/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt

+- avdd-supply: Power supply for controller (1.05V)

+ "cml": The Tegra clock of that name

Both those changes need to mention that those additions are only required for Tegra30, not Tegra20. In other words,

+- avdd-supply: Power supply for controller (1.05V) (not required for Tegra20)

+ "cml": The Tegra clock of that name (not required for Tegra20)

You probably also want to explicitly mention nvidia,tegra30-pcie as a legal compatible value.

drivers/pci/host/pci-tegra.c struct tegra_msi { · line 207

Quoted 6 lines
drivers/pci/host/pci-tegra.c +3 -0
 
+/* used to differentiate tegra chips code */ struct
+tegra_pcie_soc_data {
+	unsigned int num_max_ports;

nit: "num max" seems redundant. max_ports or num_ports would be better.

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus,

Quoted 2 lines

struct tegra_pcie_port {

drivers/pci/host/pci-tegra.c +0 -0
@@ -384,7 +408,7 @@ static int tegra_pcie_read_conf(struct pci_bus *bus,

unsigned int devfn,

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, · line 411

Quoted 5 lines
drivers/pci/host/pci-tegra.c +1 -1
 		struct tegra_pcie_port *port;
 
 		list_for_each_entry(port, &pcie->ports, list) {
-			if (port->index + 1 == slot) {
+			if (port->index == slot) {

This and the equivalent change in tegra_pcie_write_conf() seem like a bug- fix unrelated to the addition of Tegra30 support. Hence, they should be a separate patch.

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus,

Quoted 1 line
drivers/pci/host/pci-tegra.c +0 -0
@@ -398,7 +422,6 @@ static int tegra_pcie_read_conf(struct pci_bus *bus,

unsigned int devfn,

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, · line 425

Quoted 5 lines
drivers/pci/host/pci-tegra.c +0 -1
 			*value = 0xffffffff;
 			return PCIBIOS_DEVICE_NOT_FOUND;
 		}
-
 		addr += tegra_pcie_conf_offset(devfn, where);

Unnecessary white-space change.

drivers/pci/host/pci-tegra.c static int tegra_pcie_remove(struct

Quoted 1 line
drivers/pci/host/pci-tegra.c +0 -0
@@ -1549,10 +1660,9 @@ static int tegra_pcie_remove(struct

platform_device *pdev)

Quoted 3 lines
drivers/pci/host/pci-tegra.c +0 -0
 	struct tegra_pcie_bus *bus;
 	int err;
 
Quoted 11 lines

drivers/pci/host/pci-tegra.c static int tegra_pcie_remove(struct platform_device *pdev) · line 1665

Quoted 6 lines
drivers/pci/host/pci-tegra.c +2 -3
-	list_for_each_entry(bus, &pcie->busses, list) {
+	list_for_each_entry(bus, &pcie->busses, list)
 		vunmap(bus->area->addr);
-		kfree(bus);
-	}
+	kfree(bus);

This doesn't look right. Can you please explain it further? This is looping over every bus in a dynamic list, so surely each entry needs to be freed? Did you do this to avoid a crash? If so, the issue is likely that the loop should use list_for_each_entry_safe() rather than list_for_each_entry().

Yes you are right, it is not required. I will revert it along with taking care of other comments.

#4 lore raw

Re: [PATCH V3 2/4] ARM: tegra: pcie: Add tegra3 support

In reply to Stephen Warren
Quoted 1 line · Stephen Warren

On 06/04/2013 12:57 PM, Jay Agarwal wrote:

[...]

Quoted 11 lines

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, · line 411

Quoted 7 lines

struct tegra_pcie_port {

drivers/pci/host/pci-tegra.c +1 -1
@@ -384,7 +408,7 @@ static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
 		struct tegra_pcie_port *port;
 
 		list_for_each_entry(port, &pcie->ports, list) {
-			if (port->index + 1 == slot) {
+			if (port->index == slot) {

This and the equivalent change in tegra_pcie_write_conf() seem like a bug-fix unrelated to the addition of Tegra30 support. Hence, they should be a separate patch.

What exactly is this change supposed to fix? The description doesn't provide any details about why this is required. Furthermore this was done on purpose to model the Tegra PCIe controller according to what typical Linux systems provide.

Device 0:00.0 is usually the root complex, and device 0:01.0, 0:02.0 etc are the root ports. The change proposed above makes 0:00.0 the first root port, therefore breaking what systems usually expect.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130610/1cbe8463/attachment.sig>

#9 lore raw

Re: [PATCH V3 3/4] ARM: dts: tegra: Correct PCIe entry

In reply to Jay Agarwal

On Wed, Jun 05, 2013 at 12:27:31AM +0530, Jay Agarwal wrote:
[...]

arch/arm/boot/dts/tegra30.dtsi line 34

Quoted 8 lines
arch/arm/boot/dts/tegra30.dtsi +1 -1
@@ -29,7 +29,7 @@
 		ranges = <0x82000000 0 0x00000000 0x00000000 0 0x00001000   /* port 0 configuration space */
 			  0x82000000 0 0x00001000 0x00001000 0 0x00001000   /* port 1 configuration space */
 			  0x82000000 0 0x00004000 0x00004000 0 0x00001000   /* port 2 configuration space */
-			  0x81000000 0 0          0x02000000 0 0x00010000   /* downstream I/O */
+			  0x81000000 0 0          0x02000000 0 0x00100000   /* downstream I/O */
 			  0x82000000 0 0x20000000 0x20000000 0 0x10000000   /* non-prefetchable memory */
 			  0xc2000000 0 0x30000000 0x30000000 0 0x10000000>; /* prefetchable memory */

That increases the I/O region size from 64 KiB to 1 MiB. Why is that necessary? I/O operations can only address 64 KiB, so I don't think adding more makes any sense.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130610/3878be8d/attachment.sig>

#5 lore raw

RE: [PATCH V3 2/4] ARM: tegra: pcie: Add tegra3 support

In reply to Thierry Reding
Quoted 18 lines

* PGP Signed by an unknown key

Quoted 1 line · Stephen Warren

On 06/04/2013 12:57 PM, Jay Agarwal wrote:

[...]

Quoted 2 lines

Review static int tegra_pcie_read_conf(struct pci_bus

Quoted 2 lines

struct tegra_pcie_port {

(quoted diff) +0 -0
@@ -384,7 +408,7 @@ static int tegra_pcie_read_conf(struct pci_bus

*bus, unsigned int devfn,

Quoted 9 lines

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, · line 411

Quoted 5 lines
drivers/pci/host/pci-tegra.c +1 -1
 		struct tegra_pcie_port *port;
 
 		list_for_each_entry(port, &pcie->ports, list) {
-			if (port->index + 1 == slot) {
+			if (port->index == slot) {

This and the equivalent change in tegra_pcie_write_conf() seem like a bug-fix unrelated to the addition of Tegra30 support. Hence, they should be a separate patch.

Quoted 4 lines

What exactly is this change supposed to fix? The description doesn't provide any details about why this is required. Furthermore this was done on purpose to model the Tegra PCIe controller according to what typical Linux systems provide.

I have mentioned it in description as -> "Corrected logic in read/write config space to display right device number on bus 0"

Quoted 4 lines

Device 0:00.0 is usually the root complex, and device 0:01.0, 0:02.0 etc are the root ports. The change proposed above makes 0:00.0 the first root port, therefore breaking what systems usually expect.

I was seeing root port 2 in cardhu being enumerated as pci_bus 0000:03, which I thought should be pci_bus 0000:02, so made this change.

Quoted 4 lines

Thierry

* Unknown Key
* 0x7F3EB3A1

#10 lore raw

RE: [PATCH V3 3/4] ARM: dts: tegra: Correct PCIe entry

In reply to Thierry Reding
Quoted 15 lines · Jay Agarwal

[...]

Review line 29

Quoted 2 lines
(quoted diff) +0 -0
@@ -29,7 +29,7 @@
 		ranges = <0x82000000 0 0x00000000 0x00000000 0 0x00001000

/* port 0 configuration space */

Review line 30

Quoted 1 line
(quoted diff) +0 -0
 			  0x82000000 0 0x00001000 0x00001000 0 0x00001000

/* port 1 configuration space */

Review line 31

Quoted 1 line
(quoted diff) +0 -0
 			  0x82000000 0 0x00004000 0x00004000 0 0x00001000

/* port 2 configuration space */

Review line 32

Quoted 1 line
(quoted diff) +0 -1
-			  0x81000000 0 0          0x02000000 0 0x00010000   /*

downstream I/O */

Review line 32

Quoted 1 line
(quoted diff) +1 -0
+			  0x81000000 0 0          0x02000000 0 0x00100000   /*

downstream I/O */

Review line 33

Quoted 1 line
(quoted diff) +0 -0
 			  0x82000000 0 0x20000000 0x20000000 0 0x10000000
Quoted 9 lines

/* non-prefetchable memory */

Review line 34

Quoted 1 line
(quoted diff) +0 -0
 			  0xc2000000 0 0x30000000 0x30000000 0 0x10000000>;

/*

Quoted 1 line

prefetchable memory */

That increases the I/O region size from 64 KiB to 1 MiB. Why is that necessary? I/O operations can only address 64 KiB, so I don't think adding more makes any sense.

Okay, you can keep it 64KiB then, I did it to match with downstream.
Please let me know if you want me to upload new patch for this or you will take care while integrating.

#11 lore raw

Re: [PATCH V3 3/4] ARM: dts: tegra: Correct PCIe entry

In reply to Thierry Reding
Quoted 4 lines · Thierry Reding

* PGP Signed by an unknown key

On Wed, Jun 05, 2013 at 12:27:31AM +0530, Jay Agarwal wrote:
[...]

Quoted 12 lines

arch/arm/boot/dts/tegra30.dtsi line 34

Quoted 8 lines
arch/arm/boot/dts/tegra30.dtsi +1 -1
@@ -29,7 +29,7 @@
 		ranges = <0x82000000 0 0x00000000 0x00000000 0 0x00001000   /* port 0 configuration space */
 			  0x82000000 0 0x00001000 0x00001000 0 0x00001000   /* port 1 configuration space */
 			  0x82000000 0 0x00004000 0x00004000 0 0x00001000   /* port 2 configuration space */
-			  0x81000000 0 0          0x02000000 0 0x00010000   /* downstream I/O */
+			  0x81000000 0 0          0x02000000 0 0x00100000   /* downstream I/O */
 			  0x82000000 0 0x20000000 0x20000000 0 0x10000000   /* non-prefetchable memory */
 			  0xc2000000 0 0x30000000 0x30000000 0 0x10000000>; /* prefetchable memory */

That increases the I/O region size from 64 KiB to 1 MiB. Why is that necessary? I/O operations can only address 64 KiB, so I don't think adding more makes any sense.

At least PCI allows 32bit I/O addresses. No idea if anyone uses them though.

Cheers,

Peter.

#6 lore raw

Re: [PATCH V3 2/4] ARM: tegra: pcie: Add tegra3 support

In reply to Jay Agarwal
Quoted 23 lines · Jay Agarwal
Quoted 18 lines

* PGP Signed by an unknown key

Quoted 1 line · Stephen Warren

On 06/04/2013 12:57 PM, Jay Agarwal wrote:

[...]

Quoted 2 lines

Review static int tegra_pcie_read_conf(struct pci_bus

Quoted 2 lines

struct tegra_pcie_port {

(quoted diff) +0 -0
@@ -384,7 +408,7 @@ static int tegra_pcie_read_conf(struct pci_bus

*bus, unsigned int devfn,

Quoted 9 lines

drivers/pci/host/pci-tegra.c static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, · line 411

Quoted 5 lines
drivers/pci/host/pci-tegra.c +1 -1
 		struct tegra_pcie_port *port;
 
 		list_for_each_entry(port, &pcie->ports, list) {
-			if (port->index + 1 == slot) {
+			if (port->index == slot) {

This and the equivalent change in tegra_pcie_write_conf() seem like a bug-fix unrelated to the addition of Tegra30 support. Hence, they should be a separate patch.

Quoted 4 lines

What exactly is this change supposed to fix? The description doesn't provide any details about why this is required. Furthermore this was done on purpose to model the Tegra PCIe controller according to what typical Linux systems provide.

Quoted 7 lines

I have mentioned it in description as -> "Corrected logic in read/write config space to display right device number on bus 0"

Quoted 4 lines

Device 0:00.0 is usually the root complex, and device 0:01.0, 0:02.0 etc are the root ports. The change proposed above makes 0:00.0 the first root port, therefore breaking what systems usually expect.

I was seeing root port 2 in cardhu being enumerated as pci_bus 0000:03, which I thought should be pci_bus 0000:02, so made this change.

Yes, that's done on purpose to mirror what a typical PCI tree looks like, as I already explained. So unless this fixes a real bug I'll just drop it while applying.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130611/e28e7f75/attachment-0001.sig>

#7 lore raw

RE: [PATCH V3 2/4] ARM: tegra: pcie: Add tegra3 support

Quoted 7 lines
Quoted 1 line

I have mentioned it in description as -> "Corrected logic in read/write

config space to display right device number on bus 0"

Quoted 5 lines
Quoted 5 lines

Device 0:00.0 is usually the root complex, and device 0:01.0, 0:02.0 etc are the root ports. The change proposed above makes 0:00.0 the first root port, therefore breaking what systems usually expect.

Quoted 6 lines
Quoted 1 line

I was seeing root port 2 in cardhu being enumerated as pci_bus 0000:03,

which I thought should be pci_bus 0000:02, so made this change.

Yes, that's done on purpose to mirror what a typical PCI tree looks like, as I already explained. So unless this fixes a real bug I'll just drop it while applying.

Please apply V4 patch instead which does not contain this change along with taking care of other review comments.

#15 lore raw
In reply to Stephen Warren

Quoting Stephen Warren (2013-06-04 12:08:08)

Quoted 12 lines · Jay Agarwal
Quoted 7 lines

Registering pciex as peripheral clock instead of fixed clock as tegra_perih_reset_assert(deassert) api of this clock api gives warning and ultimately does not succeed to assert(deassert).

---
Patch is based on remotes/gitorious_thierryreding_linux/tegra/next and should be applied on top of this.

For this change, Mike may as well apply it directly to the clock tree. Thierry can then pick it up when he rebases his tegra/next tree.

Quoted 7 lines

That said, I don't think you should need any of the TEGRA_CLK_DUPLICATE() entries; the PCIe driver should get its clocks from device tree now, and hence the driver name in the clock registration shouldn't be necessary. All of these TEGRA_CLK_DUPLICATE() entries should be removed en mass sometime soon with luck. So, can you simply leave the two TEGRA_CLK_DUPLICATE() entries untouched, rather than changing them?

Ping on this patch. I can take it through my tree, but is there going to be rework based on Stephen's comments?

Regards,
Mike

#16 lore raw
Quoted 19 lines

Quoting Stephen Warren (2013-06-04 12:08:08)

Quoted 8 lines · Jay Agarwal
Quoted 7 lines

Registering pciex as peripheral clock instead of fixed clock as tegra_perih_reset_assert(deassert) api of this clock api gives warning and ultimately does not succeed to assert(deassert).

---
Patch is based on remotes/gitorious_thierryreding_linux/tegra/next and

should be applied on top of this.

Quoted 9 lines

For this change, Mike may as well apply it directly to the clock tree. Thierry can then pick it up when he rebases his tegra/next tree.

That said, I don't think you should need any of the TEGRA_CLK_DUPLICATE() entries; the PCIe driver should get its clocks from device tree now, and hence the driver name in the clock registration shouldn't be necessary. All of these TEGRA_CLK_DUPLICATE() entries should be removed en mass sometime

Quoted 6 lines

soon

Quoted 2 lines

with luck. So, can you simply leave the two TEGRA_CLK_DUPLICATE() entries untouched, rather than changing them?

Ping on this patch. I can take it through my tree, but is there going to be rework based on Stephen's comments?

Hi Mike,
I have uploaded next version V4 of this patch after taking care of this comment.

#12 lore raw

Re: [PATCH V3 3/4] ARM: dts: tegra: Correct PCIe entry

In reply to Peter De Schrijver
Quoted 18 lines · Peter De Schrijver
Quoted 4 lines · Thierry Reding

* PGP Signed by an unknown key

On Wed, Jun 05, 2013 at 12:27:31AM +0530, Jay Agarwal wrote:
[...]

Quoted 12 lines

arch/arm/boot/dts/tegra30.dtsi line 34

Quoted 8 lines
arch/arm/boot/dts/tegra30.dtsi +1 -1
@@ -29,7 +29,7 @@
 		ranges = <0x82000000 0 0x00000000 0x00000000 0 0x00001000   /* port 0 configuration space */
 			  0x82000000 0 0x00001000 0x00001000 0 0x00001000   /* port 1 configuration space */
 			  0x82000000 0 0x00004000 0x00004000 0 0x00001000   /* port 2 configuration space */
-			  0x81000000 0 0          0x02000000 0 0x00010000   /* downstream I/O */
+			  0x81000000 0 0          0x02000000 0 0x00100000   /* downstream I/O */
 			  0x82000000 0 0x20000000 0x20000000 0 0x10000000   /* non-prefetchable memory */
 			  0xc2000000 0 0x30000000 0x30000000 0 0x10000000>; /* prefetchable memory */

That increases the I/O region size from 64 KiB to 1 MiB. Why is that necessary? I/O operations can only address 64 KiB, so I don't think adding more makes any sense.

Quoted 1 line

At least PCI allows 32bit I/O addresses. No idea if anyone uses them though.

I just realized that we are constrained to 64 KiB by the implementation of pci_ioremap_io(), which assumes each mapping is 64 KiB. Not that it couldn't be changed, but unless there actually is a use-case where more than 64 KiB are required I don't think we should worry about it.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130717/db9411c6/attachment.sig>