Skip to contentSkip to conversation

ARM: tegra30: clocks: Fix pciex clock registration

PATCH Superseded Jay Agarwal 2 participants 17 messages May 8, 2013 – Jun 4, 2013 7 messages not in the archive

Subsystems (7)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 drivers/clk/tegra/clk-tegra30.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/clk/tegra/clk-tegra30.c +6 -6
index ba6f51b..6a80b40 100644
@@ -1592,6 +1592,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", NULL);
+	clks[pciex] = clk;
+
 	/* kfuse */
 	clk = tegra_clk_register_periph_gate("kfuse", "clk_m",
 				    TEGRA_PERIPH_ON_APB,
@@ -1710,11 +1716,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)
@@ -1930,7 +1931,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
 	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(vcp, "nvavp", "vcp"),
 	TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */
 };
Signature · 1 line
1.7.0.4
#1 lore raw

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

- 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
- Patch is based on remotes/gitorious_thierryreding_linux/tegra/next
- and should be applied on top of this.

---
 .../bindings/pci/nvidia,tegra20-pcie.txt           |    1 +
 drivers/pci/host/pci-tegra.c                       |  145 +++++++++++++++++---
 2 files changed, 127 insertions(+), 19 deletions(-)
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +1 -0
index 1ebc526..b4c4e42 100644
@@ -91,6 +91,7 @@ Board DTS:
 	pcie-controller {
 		vdd-supply = <&pci_vdd_reg>;
 		pex-clk-supply = <&pci_clk_reg>;
+		avdd-supply = <&ldo2_reg>; /* required for tegra30 */
 		status = "okay";
 
 		/* root port 00:01.0 */
drivers/pci/host/pci-tegra.c +126 -19

350 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

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

Quoted 7 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

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

Again, those two lines would go below the ---. And since that's all one bullet point, why is the second line indented with a "-"?

Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt Board DTS: · line 94

Quoted 6 lines
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +1 -0
 
 	pcie-controller {
 		vdd-supply = <&pci_vdd_reg>;
 		pex-clk-supply = <&pci_clk_reg>;
+		avdd-supply = <&ldo2_reg>; /* required for tegra30 */

I would simply drop that comment, and perhaps even the whole line; this is just an example after all, and doesn't need to cover the latest SoC. Equally, the example SoC DTSI section is an example for Tegra20, so making the example board DTS section contain a Tegra30 example would be inconsistent. Tegra30 should be capitalized; it's a name.

Why is there no change to the "Required Properties" section of this document? It should list the set of clocks and regulators that are required. That section is the definitive reference, whereas the example is just than; an example.

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

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

Perhaps those 2 values should be u32 to match the readl/writel parameters? They're HW register values after all.

drivers/pci/host/pci-tegra.c struct tegra_pcie { · line 243

Quoted 5 lines
drivers/pci/host/pci-tegra.c +1 -0
@@ -220,6 +240,7 @@ struct tegra_pcie {
 	struct clk *afi_clk;
 	struct clk *pcie_xclk;
 	struct clk *pll_e;
+	struct clk *cml0_clk;

I think this clock should be called "cml" not "cml0". The clocks within the driver and DT binding should be named from the perspective of the PCI HW unit, and not from the perspective of the system that surrounds it and provides those clocks.

The only exception would be if some future Tegra version might end up with multiple cml clocks to a single PCIe unit, and we need to number them to identify them. However, that seems quite unlikely since the PCIe unit already supports multiple ports, and multiple port support would be about the only reason that I could think of to have multiple clock instances.

I think I mentioned this when I reviewed the previous version of the patch, but you didn't respond to the suggestion.

drivers/pci/host/pci-tegra.c static int tegra_pcie_enable_controller(struct tegra_pcie *pcie) · line 785

Quoted 9 lines
drivers/pci/host/pci-tegra.c +5 -0
@@ -749,6 +778,11 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
 	struct tegra_pcie_port *port;
 	unsigned int timeout;
 	unsigned long value;
+	struct tegra_pcie_soc_data *soc = pcie->soc_data;
+
+	/* power down to PCIe slot clock bias pad */
+	if (soc->pex_bias_ctrl)
+		afi_writel(pcie, 0, AFI_PEXBIAS_CTRL_0);

Renaming pex_bias_ctrl to has_pex_bias_ctrl might make it more obvious what that variable means.

A similar comment might apply to soc->pex_clkreq_en and soc->intr_prsnt_sense.

#3 lore raw

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

In reply to Jay Agarwal

- Add interrupt-names property
- Correct downstream I/O size
- Correct cml clock name for Tegra30
- Patch is based on remotes/gitorious_thierryreding_linux/tegra/next
- and should be applied on top of this.

---
 arch/arm/boot/dts/tegra30.dtsi |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/tegra30.dtsi +3 -3
index 5a270ff..289ef93 100644
@@ -124,7 +124,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>;
@@ -132,13 +132,13 @@
 		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 */
 
 		clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>,
 			 <&tegra_car 118>, <&tegra_car 215>;
-		clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml";
+		clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml0";
 		status = "disabled";
 
 		pci at 1,0 {
Signature · 1 line
1.7.0.4
#4 lore raw

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

Quoted 5 lines · Jay Agarwal

- Add interrupt-names property
- Correct downstream I/O size
- Correct cml clock name for Tegra30
- Patch is based on remotes/gitorious_thierryreding_linux/tegra/next
- and should be applied on top of this.

Another change that needs to be made to this file (probably as a separate change that Thierry can squash into one of his earlier changes) is to move the pcie-controller node; it is currently not in the correct place in the .dtsi file; it's not sorted by reg addresss.

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

Quoted 6 lines
arch/arm/boot/dts/tegra30.dtsi +1 -1
 
 		clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>,
 			 <&tegra_car 118>, <&tegra_car 215>;
-		clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml";
+		clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml0";

You could drop that change if the driver named the clock "cml" rather than "cml0", which as I explained in my previous email seems like a good idea anyway.

Applying the same reasoning, I wonder if for Tegra 20 too, the PCIe driver shouldn't expect clock names of just "xclk" and "pll" rather than "pcie_xclk" and "pll_e".

#5 lore raw

PATCH 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.

---
 arch/arm/boot/dts/tegra30-cardhu.dtsi |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra30-cardhu.dtsi +11 -0
index d2fdf95..8f8e07b 100644
@@ -27,6 +27,17 @@
 	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 at 3,0 {
+			status = "okay";
+		};
+	};
+
 	host1x {
 		dc at 54200000 {
 			rgb {
Signature · 1 line
1.7.0.4
#6 lore raw

Re: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

Quoted 8 lines · 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.

arch/arm/boot/dts/tegra30-cardhu.dtsi +0 -0
 

arch/arm/boot/dts/tegra30-cardhu.dtsi line 39

Quoted 10 lines
arch/arm/boot/dts/tegra30-cardhu.dtsi +10 -0
+	pcie-controller {
+		status = "okay";
+		pex-clk-supply = <&pex_hvdd_3v3_reg>;
+		vdd-supply = <&ldo1_reg>;
+		avdd-supply = <&ldo2_reg>;
+
+		pci at 3,0 {
+			status = "okay";
+		};
+	};

So, if I apply this series, I do see the PCIe bridge and Ethernet device get enumerated, but I don't see the USB3 controller get enumerated. I believe that is a PCIe device behind the same bridge on the same Tegra PCIe port. Shouldn't this device show up?

The Ethernet interface gets an IP address by DHCP, so some amount of data must be flowing. However, I cannot ping anything. If I run the same kernel on a Tegra20 TrimSlice board, which has the same Ethernet chip, then everything works as expected. Have you fully tested network connectivity with these patches applied? Perhaps this is related to the next problem:

According to the Cardhu schematics, the PCIe link to the dock is a single lane. Hence, I believe that the Cardhu DT should describe a 411 port configuration. However, the Cardhu DT doesn't describe any particular link configuration, but just inherits the default from tegra30.dtsi, which describes a 222 link configuration. I would have expected the following in the Cardhu DT:

		pci at 1,0 {
			nvidia,num-lanes = <4>;
		};

		pci at 2,0 {
			nvidia,num-lanes = <1>;
		};

		pci at 3,0 {
			status = "okay";
			nvidia,num-lanes = <1>;
		};

However, if I put that there, no PCIe links are detected at all. Why does the driver work with the wrong link configuration, but fail with the correct one?

Related, I notice that in Thierry's patches which you're building on, tegra_pcie_get_xbar_config() still has a bug where a zero return value is treated as an error, even though it's a valid HW register value. Perhaps this is related?

#7 lore raw

Re: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

Quoted 19 lines · Stephen Warren
Quoted 18 lines · 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.

arch/arm/boot/dts/tegra30-cardhu.dtsi +10 -0
 
+	pcie-controller {
+		status = "okay";
+		pex-clk-supply = <&pex_hvdd_3v3_reg>;
+		vdd-supply = <&ldo1_reg>;
+		avdd-supply = <&ldo2_reg>;
+
+		pci at 3,0 {
+			status = "okay";
+		};
+	};

...

Quoted 20 lines

According to the Cardhu schematics, the PCIe link to the dock is a single lane. Hence, I believe that the Cardhu DT should describe a 411 port configuration. However, the Cardhu DT doesn't describe any particular link configuration, but just inherits the default from tegra30.dtsi, which describes a 222 link configuration. I would have expected the following in the Cardhu DT:

		pci at 1,0 {
			nvidia,num-lanes = <4>;
		};

		pci at 2,0 {
			nvidia,num-lanes = <1>;
		};

		pci at 3,0 {
			status = "okay";
			nvidia,num-lanes = <1>;
		};
Quoted 3 lines

However, if I put that there, no PCIe links are detected at all. Why does the driver work with the wrong link configuration, but fail with the correct one?

I take this back. Fixing the DT as shown above to represent the correct 4/1/1 configuration does still yield a working system. Please incorporate this into a future patch revision.

The issue is more that PCIe enumeration is only reliable after a cold power cycle of the dock (the dock appears to be powered solely by its power cable and never the battery in Cardhu, and hence isn't affected by the main tablet PMIC's power on/off state like most of the board is). Is there some reset signal to the dock that the bootloader or kernel should be driving to solve this?

#8 lore raw

RE: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

In reply to Stephen Warren
Quoted 11 lines · Jay Agarwal
Quoted 8 lines

- 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.

arch/arm/boot/dts/tegra30-cardhu.dtsi +0 -0
Quoted 15 lines

arch/arm/boot/dts/tegra30-cardhu.dtsi line 39

Quoted 10 lines
arch/arm/boot/dts/tegra30-cardhu.dtsi +10 -0
+	pcie-controller {
+		status = "okay";
+		pex-clk-supply = <&pex_hvdd_3v3_reg>;
+		vdd-supply = <&ldo1_reg>;
+		avdd-supply = <&ldo2_reg>;
+
+		pci at 3,0 {
+			status = "okay";
+		};
+	};

So, if I apply this series, I do see the PCIe bridge and Ethernet device get enumerated, but I don't see the USB3 controller get enumerated. I believe that is a PCIe device behind the same bridge on the same Tegra PCIe port. Shouldn't this device show up?

[>] I have also reproduced this problem. I see somehow no non-prefetchable memory is assigned to any of pcie devices. Probably that is the reason for USB3 (pci 0000:04:00.0) not getting enumerated since it uses only non-prefetchable memory.

#9 lore raw

RE: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

Quoted 24 lines
Quoted 10 lines · Jay Agarwal
Quoted 8 lines

- 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.

arch/arm/boot/dts/tegra30-cardhu.dtsi +0 -0
Quoted 14 lines

arch/arm/boot/dts/tegra30-cardhu.dtsi line 39

Quoted 10 lines
arch/arm/boot/dts/tegra30-cardhu.dtsi +10 -0
+	pcie-controller {
+		status = "okay";
+		pex-clk-supply = <&pex_hvdd_3v3_reg>;
+		vdd-supply = <&ldo1_reg>;
+		avdd-supply = <&ldo2_reg>;
+
+		pci at 3,0 {
+			status = "okay";
+		};
+	};

So, if I apply this series, I do see the PCIe bridge and Ethernet device get enumerated, but I don't see the USB3 controller get enumerated. I believe that is a PCIe device behind the same bridge on the

Quoted 6 lines

same Tegra PCIe port.

Quoted 1 line

Shouldn't this device show up?

I have also reproduced this problem. I see somehow no non- prefetchable memory is assigned to any of pcie devices. Probably that is the reason for USB3 (pci 0000:04:00.0) not getting enumerated since it uses only non-prefetchable memory.

1. Bus4(on which usb3 device resides) always return 0xffffffff from it's config space. which means device is not present?
2. That's why it is not assigned any resources and hence no usb3 probe happens.
3. But same bus does return valid info like vendor/device id etc from it's config space in downstream kernel and hence usb3 probe does happen.

Thierry, Stephen,
4. Any idea why bus4 should return 0xffffffff values in upstream kernel? Anything missing?
5. Also, how config space of all pcie devices are mapped? I mean if I change the config space offset in dts file, then also I find correct vendor/device id etc for bus0/device0/fun0. So how this mapping happens that even after changing the config space offset in PCIe address space, it always finds correct vendor/device id.

#10 lore raw

Re: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

Quoted 6 lines · Jay Agarwal
Quoted 6 lines
Quoted 6 lines · Jay Agarwal
Quoted 5 lines

- 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.

...

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

So, if I apply this series, I do see the PCIe bridge and Ethernet device get enumerated, but I don't see the USB3 controller get enumerated. I believe that is a PCIe device behind the same bridge on the same Tegra PCIe port.
Shouldn't this device show up?

I have also reproduced this problem. I see somehow no non- prefetchable memory is assigned to any of pcie devices. Probably that is the reason for USB3 (pci 0000:04:00.0) not getting enumerated since it uses only non-prefetchable memory.

Quoted 6 lines

1. Bus4(on which usb3 device resides) always return 0xffffffff from it's config space. which means device is not present?
2. That's why it is not assigned any resources and hence no usb3 probe happens.
3. But same bus does return valid info like vendor/device id etc from it's config space in downstream kernel and hence usb3 probe does happen.

Thierry, Stephen,
4. Any idea why bus4 should return 0xffffffff values in upstream kernel? Anything missing?

Is there some reset/enable GPIO or regulator that needs to be programmed to enable the PCIe USB3 controller? Take a look at the schematic. If you can make it work by tweaking those GPIOs/... manually, then we can ignore this issue and fix it up later, since it's not directly related to the PCIe controller driver patches. It's more important to get this Ethernet working than USB, I think.

Quoted 2 lines

5. Also, how config space of all pcie devices are mapped? I mean if I change the config space offset in dts file, then also I find correct vendor/device id etc for bus0/device0/fun0. So how this mapping happens that even after changing the config space offset in PCIe address space, it always finds correct vendor/device id.

Can you please word-wrap your email less than 80 columns? It's quite hard to read.

I don't quite understand your question. The PCIe driver implements the functions that access config space. I don't recall that being influenced by anything much in the device tree, except for the 3rd entry in the top-level PCIe controller's reg property:

        pcie-controller {
                compatible = "nvidia,tegra30-pcie";
                device_type = "pci";
                reg = <0x00003000 0x00000800   /* PADS registers */
                       0x00003800 0x00000200   /* AFI registers */
                       0x10000000 0x10000000>; /* configuration space */
#11 lore raw

RE: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

In reply to Jay Agarwal
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

So, if I apply this series, I do see the PCIe bridge and Ethernet device get enumerated, but I don't see the USB3 controller get enumerated. I believe that is a PCIe device behind the same bridge on the

same Tegra PCIe port.

Quoted 1 line

Shouldn't this device show up?

I have also reproduced this problem. I see somehow no non- prefetchable memory is assigned to any of pcie devices. Probably that is the reason for USB3 (pci 0000:04:00.0) not getting enumerated since it uses only non-prefetchable memory.

1. Bus4(on which usb3 device resides) always return 0xffffffff from it's config space. which means device is not present?
2. That's why it is not assigned any resources and hence no usb3 probe happens.
3. But same bus does return valid info like vendor/device id etc from it's config space in downstream kernel and hence usb3 probe does happen.

Quoted 8 lines

Thierry, Stephen,
4. Any idea why bus4 should return 0xffffffff values in upstream kernel? Anything missing?
5. Also, how config space of all pcie devices are mapped? I mean if I change the config space offset in dts file, then also I find correct vendor/device id etc for bus0/device0/fun0.
So how this mapping happens that even after changing the config space
offset in PCIe address space, it always finds correct vendor/device id.

Any idea on this?

#12 lore raw

Re: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

Quoted 27 lines · Jay Agarwal
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

So, if I apply this series, I do see the PCIe bridge and Ethernet device get enumerated, but I don't see the USB3 controller get enumerated. I believe that is a PCIe device behind the same bridge on the

same Tegra PCIe port.

Quoted 1 line

Shouldn't this device show up?

I have also reproduced this problem. I see somehow no non- prefetchable memory is assigned to any of pcie devices. Probably that is the reason for USB3 (pci 0000:04:00.0) not getting enumerated since it uses only non-prefetchable memory.

1. Bus4(on which usb3 device resides) always return 0xffffffff from it's config space. which means device is not present?
2. That's why it is not assigned any resources and hence no usb3 probe happens.
3. But same bus does return valid info like vendor/device id etc from it's config space in downstream kernel and hence usb3 probe does happen.

Quoted 8 lines

Thierry, Stephen,
4. Any idea why bus4 should return 0xffffffff values in upstream kernel? Anything missing?
5. Also, how config space of all pcie devices are mapped? I mean if I change the config space offset in dts file, then also I find correct vendor/device id etc for bus0/device0/fun0.
So how this mapping happens that even after changing the config space
offset in PCIe address space, it always finds correct vendor/device id.

Quoted 1 line

Any idea on this?

I did already reply the same day you sent the original email. My response was:

Is there some reset/enable GPIO or regulator that needs to be programmed to enable the PCIe USB3 controller? Take a look at the schematic. If you can make it work by tweaking those GPIOs/... manually, then we can ignore this issue and fix it up later, since it's not directly related to the PCIe controller driver patches. It's more important to get the Ethernet working than USB, I think.

To be honest though, I would expect you to be asking around inside NVIDIA to determine the answer here. As the PCIe SW expert, I'd expect you to drive this process. Try asking the Cardhu board and PCIe HW experts within NVIDIA.

Did you make any progress on the issues with the Ethernet device?

#13 lore raw

RE: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

Quoted 42 lines · Jay Agarwal
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

So, if I apply this series, I do see the PCIe bridge and Ethernet device get enumerated, but I don't see the USB3 controller get enumerated. I believe that is a PCIe device behind the same bridge on the

same Tegra PCIe port.

Quoted 1 line

Shouldn't this device show up?

I have also reproduced this problem. I see somehow no non- prefetchable memory is assigned to any of pcie devices. Probably that is the reason for USB3 (pci 0000:04:00.0) not getting enumerated since it uses only non-prefetchable memory.

Quoted 6 lines
Quoted 6 lines

1. Bus4(on which usb3 device resides) always return 0xffffffff from it's config space. which means device is not present?
2. That's why it is not assigned any resources and hence no usb3 probe happens.
3. But same bus does return valid info like vendor/device id etc from it's config space in downstream kernel and hence usb3 probe does

happen.

Quoted 9 lines
Quoted 9 lines

Thierry, Stephen,
4. Any idea why bus4 should return 0xffffffff values in upstream kernel? Anything missing?
5. Also, how config space of all pcie devices are mapped? I mean if I change the config space offset in dts file, then also I find correct vendor/device id etc for bus0/device0/fun0.
So how this mapping happens that even after changing the config
space offset in PCIe address space, it always finds correct vendor/device

id.

Quoted 2 lines

Any idea on this?

I did already reply the same day you sent the original email. My response was:

Is there some reset/enable GPIO or regulator that needs to be programmed to enable the PCIe USB3 controller? Take a look at the schematic. If you can make it work by tweaking those GPIOs/... manually, then we can ignore this issue and fix it up later, since it's not directly related to the PCIe controller driver patches. It's more important to get the Ethernet working than USB, I think.

Quoted 6 lines

To be honest though, I would expect you to be asking around inside NVIDIA to determine the answer here. As the PCIe SW expert, I'd expect you to drive this process. Try asking the Cardhu board and PCIe HW experts within NVIDIA.

Did you make any progress on the issues with the Ethernet device?

Stephen,
I have taken care of all your comments, but Ethernet device is not working for me neither on cardhu nor harmony. Could be related to my process or board, Currently debugging this.
Parallely, should I push my patches for review so that it is clear from other aspects?

#14 lore raw

Re: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

On 05/30/2013 11:37 AM, Jay Agarwal wrote:
...

Quoted 2 lines

I have taken care of all your comments, but Ethernet device is not working for me neither on cardhu nor harmony. Could be related to my process or board, Currently debugging this.

Are you talking about a PCIe-based Ethernet device on Harmony, or the one that's built into the board?

The on-board Ethernet device is USB, and should work fine already, and irrespective of any PCIe patches.

I have only tried an XHCI USB controller in the PCIe slot on Harmony, so I can't say if Ethernet not working is a regression or not. Does the Ethernet device work with just Thierry's patches and not yours?

Quoted 1 line

Parallely, should I push my patches for review so that it is clear from other aspects?

Well, if the patches don't work, I suppose there's not much use posting them since they'll just need changes before they can be usefully applied anyway. IIRC, most of my comments last time were fairly minor, so there isn't much need for a separate review of them, right?

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#22 lore raw

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

<Forwarding to bigger aliases>

Anybody aware of hang in r8169 driver over pcie interface mentioned at bottom of this mail?

-----Original Message-----
From: Jay Agarwal
Sent: Tuesday, June 04, 2013 7:17 PM
To: 'Stephen Warren'
Cc: 'thierry.reding at avionic-design.de'
Subject: RE: [PATCH 4/4] ARM: tegra: pcie: Enable PCIe controller on Cardhu

Quoted 61 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Jay Agarwal
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

I have taken care of all your comments, but Ethernet device is not working

for me neither on cardhu nor harmony.

Quoted 2 lines

Could be related to my process or board, Currently debugging

this.

Quoted 54 lines
Quoted 44 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines

Are you talking about a PCIe-based Ethernet device on Harmony, or the one that's built into the board?

The on-board Ethernet device is USB, and should work fine already, and irrespective of any PCIe patches.

No I am talking about ethernet over PCIe interface. There is no problem

Quoted 15 lines
Quoted 6 lines

with built-in ethernet over USB.

Quoted 5 lines
Quoted 5 lines

I have only tried an XHCI USB controller in the PCIe slot on Harmony, so I can't say if Ethernet not working is a regression or not. Does the Ethernet device work with just Thierry's patches and not

yours?

Quoted 8 lines
Quoted 7 lines

It does not work w/o any of my patches also.

Thierry,
Have you verified any ethernet card working on harmony? I am using Broadcom Ethernet card with TIGON3 driver, but it does not

work although PCIe enumeration and driver probe looks fine as

attached.

Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Any idea?

Oh, one thing to consider here: PCIe interrupts don't work correctly when
LP2 is enabled, at least in the upstream kernel. It's something I've been trying to investigate, but haven't tracked down yet.

Anyway, you need to disable the LP2 CPU power management state for sure.
Hopefully this will solve the issue for you. One way to do this is the following patch, although we need a better solution before we can actually merge anything:

Quoted 5 lines
Quoted 1 line

https://patchwork.kernel.org/patch/2525151/

Stephen,
This patch also did not resolve the issue although I do get "Disabling
LP2 cpuidle state..." message in logs.

Quoted 6 lines

It stucks as below:

root at localhost:~# dhclient eth0

[ 1444.579544] smsc95xx 3-1.1:1.0 eth0: hardware isn't capable of 

remote wakeup [ 1444.587300] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

My system does not have ping command, so dhclient fails like below:
/sbin/dhclient-script: line 325: ping: command not found

Quoted 6 lines
Quoted 1 line

So I provided static IP as : ifconfig eth0 <IP> but it also did not help.

Actually sorry, I was using wrong Ethernet interface(eth0) on
harmony, but correct one is eth1(over pcie interface) which works fine on Thierry's repo after applying patches to disable LP2. Now I will try after applying my patches on both harmony and cardhu.

Ethernet is working on harmony is working w/ & a/o my patches but cardhu is hanging as below:

root at localhost:~# ifconfig eth0 10.19.65.115 [ 102.525245] r8169 0000:03:00.0 eth0: unable to load firmware patch rtl_nic/rtl8168e-3.fw (-2) [ 102.951516] r8169 0000:03:00.0 eth0: rtl_phyar_cond == 1 (loop: 20, delay: 25). <System hangs here..>

1. Harmony is using Broadcom pcie Ethernet card and cardhu is using realtek one.
2. Enumeration and lspci seems to be fine though.
3. I tried applying similar patches for disabling LP2 for tegra 3 as well but it did not help.
4. Any idea/opinion?

#23 lore raw
In reply to Jay Agarwal
Quoted 3 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).

A few procedural comments: I believe this is at least the second version of these patches that have been posted. As such, the email subject should say e.e. "PATCH V2" not just "PATCH". You can pass --subject-prefix='PATCH V2' to git format-patch to achieve this.

Since this is an updated version of the patches, each patch should describe what changed in the patch, so that people know what issues you've fixed in this version. Most people believe that the description of changes should be below the --- line, so that it doesn't get included in the commit description when the patch is applied.

Quoted 2 lines

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

Those two lines should be below the --- line so that they don't get included in the commit description when the patch is applied. git metadata will provide clues re: who applied the patch and to which branch, so there's no need to duplicate this information in the commit description itself, but rather include it below --- so that it's still present and people can see it.

Some comments on the patch and series below...

drivers/clk/tegra/clk-tegra30.c static void __init tegra30_periph_clk_init(void) · line 1599

Quoted 7 lines
drivers/clk/tegra/clk-tegra30.c +5 -0
 
+	/* 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", NULL);
+	clks[pciex] = clk;

Hmmm. This change perhaps isn't technically correct, but is the best we can do for now, so it's fine. It's also consistent with how the Tegra20 clock driver is written.

This clock has a "reset" bit in the CLK_RST_* registers, but not an "enable" bit in the CLK_ENB_* registers. Hence, representing this as a gated clock isn't correct, since there is not gate control in HW. The correct way to handle this would be to implement the new reset controller API for Tegra, and expose the reset control only, and not touch the clock registration at all. However, we do this exact same thing for a number of Tegra clocks right now, hence I think this change is fine for now; we'll clean this up, along with some other instances of the same issue, once the reset API is implemented for Tegra. Of course, if that happens before the PCI code is checked in, then my opinion will change.

drivers/clk/tegra/clk-tegra30.c static struct tegra_clk_duplicate tegra_clk_duplicates[] = { · line 1933

Quoted 5 lines
drivers/clk/tegra/clk-tegra30.c +0 -1
@@ -1930,7 +1931,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
 	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"),

That seems like an unrelated change, and isn't mentioned in the commit description. Is the change strictly necessary? Is it cleanup that can happen as a separate patch later in the series? Aren't you able to remove the CLK_DUPLICATE() entries for other PCIe-related clocks too?