Skip to contentSkip to conversation

ARM: tegra: remove dead code

PATCH New Stephen Warren 2 participants 6 messages Aug 28, 2012 – Sep 11, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: tegra: remove dead code

From: Stephen Warren <[email protected]>

Now that all boards are converted to device tree, devices.[ch] and board-pinmux.[ch] are no longer used. So, remove them.

The only exception is the EHCI platform data in devices.h. Move that data to board-dt-tegra20.c - the only places it's used.

---
These patches are both destined for Tegra's for-3.7/board-removal branch.

 arch/arm/mach-tegra/Makefile           |    2 -
 arch/arm/mach-tegra/board-dt-tegra20.c |   27 +-
 arch/arm/mach-tegra/board-pinmux.c     |   87 ----
 arch/arm/mach-tegra/board-pinmux.h     |   54 ---
 arch/arm/mach-tegra/devices.c          |  701 --------------------------------
 arch/arm/mach-tegra/devices.h          |   60 ---
 6 files changed, 26 insertions(+), 905 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/board-pinmux.c
 delete mode 100644 arch/arm/mach-tegra/board-pinmux.h
 delete mode 100644 arch/arm/mach-tegra/devices.c
 delete mode 100644 arch/arm/mach-tegra/devices.h
arch/arm/mach-tegra/Makefile +0 -2
index b94858f..90a40c3 100644
@@ -1,6 +1,4 @@
-obj-y                                   += board-pinmux.o
 obj-y                                   += common.o
-obj-y                                   += devices.o
 obj-y                                   += io.o
 obj-y                                   += irq.o
 obj-y                                   += clock.o
arch/arm/mach-tegra/board-dt-tegra20.c +26 -1
index d9eeae6..30f8036 100644
@@ -28,6 +28,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/pda_power.h>
+#include <linux/platform_data/tegra_usb.h>
 #include <linux/io.h>
 #include <linux/i2c.h>
 #include <linux/i2c-tegra.h>
@@ -40,11 +41,35 @@
 
 #include <mach/iomap.h>
 #include <mach/irqs.h>
+#include <mach/usb_phy.h>
 
 #include "board.h"
 #include "board-harmony.h"
 #include "clock.h"
-#include "devices.h"
+
+struct tegra_ehci_platform_data tegra_ehci1_pdata = {
+	.operating_mode = TEGRA_USB_OTG,
+	.power_down_on_bus_suspend = 1,
+	.vbus_gpio = -1,
+};
+
+struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
+	.reset_gpio = -1,
+	.clk = "cdev2",
+};
+
+struct tegra_ehci_platform_data tegra_ehci2_pdata = {
+	.phy_config = &tegra_ehci2_ulpi_phy_config,
+	.operating_mode = TEGRA_USB_HOST,
+	.power_down_on_bus_suspend = 1,
+	.vbus_gpio = -1,
+};
+
+struct tegra_ehci_platform_data tegra_ehci3_pdata = {
+	.operating_mode = TEGRA_USB_HOST,
+	.power_down_on_bus_suspend = 1,
+	.vbus_gpio = -1,
+};
 
 struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL),
arch/arm/mach-tegra/board-pinmux.c deleted +0 -87

87 lines not on this page · raw message

arch/arm/mach-tegra/board-pinmux.h deleted +0 -54

54 lines not on this page · raw message

arch/arm/mach-tegra/devices.c deleted +0 -701

701 lines not on this page · raw message

arch/arm/mach-tegra/devices.h deleted +0 -60

60 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author Applied
#1 lore raw

PATCH 1/2 ARM: tegra: remove dead code

Quoted 9 lines · Stephen Warren

From: Stephen Warren <[email protected]>

Now that all boards are converted to device tree, devices.[ch] and board-pinmux.[ch] are no longer used. So, remove them.

The only exception is the EHCI platform data in devices.h. Move that data to board-dt-tegra20.c - the only places it's used.

Applied this 1 patch to Tegra's for-3.7/cleanup2 branch.

Note that the crash Laxman reported against this series was due to patch 2/2, which has since been revised and applied. Patch 1/1 didn't have issues.

#2 lore raw

PATCH 1/2 ARM: tegra: remove dead code

In reply to Stephen Warren
Quoted 11 lines · Stephen Warren

From: Stephen Warren<[email protected]>

Now that all boards are converted to device tree, devices.[ch] and board-pinmux.[ch] are no longer used. So, remove them.

The only exception is the EHCI platform data in devices.h. Move that data to board-dt-tegra20.c - the only places it's used.

---
These patches are both destined for Tegra's for-3.7/board-removal branch.

I applied both patches and it crash on with following log:

[    1.652934] VFP support v0.3: implementor 41 architecture 3 part 30 
variant 9
  rev 1
[    1.661661] Unable to handle kernel paging request at virtual address 
fffffe0
7
[    1.670980] pgd = c0004000
[    1.673711] [fffffe07] *pgd=2f7fe821, *pte=00000000, *ppte=00000000
[    1.679988] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[    1.685369] Modules linked in:
[    1.688419] CPU: 0    Not tainted  (3.6.0-rc3-next-20120824-dirty #2)
[    1.694852] PC is at regulator_disable+0x4/0x60
[    1.699378] LR is at harmony_pcie_init+0x50/0xa0
[    1.703983] pc : [<c01f71f0>]    lr : [<c05e3810>]    psr: 20000013
[    1.703983] sp : ef04bf38  ip : 22222222  fp : 00000000
[    1.715434] r10: c05dd690  r9 : c0602eb0  r8 : c05db26c
[    1.720642] r7 : 00000000  r6 : fffffdfb  r5 : c0459004  r4 : fffffdfb
[    1.727151] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : fffffdfb
[    1.733663] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  
Segment kern
el
[    1.740953] Control: 10c5387d  Table: 0000404a  DAC: 00000015
[    1.746682] Process swapper/0 (pid: 1, stack limit = 0xef04a2f0)
[    1.752672] Stack: (0xef04bf38 to 0xef04c000)
[    1.757015] 
bf20:                                                       fffff
dfb c0459004
[    1.765174] bf40: fffffdfb c05e3810 00000002 c0459004 c045900c 
c05e3718 c05e3
710 c05e36f8
[    1.773333] bf60: c05fd8ec ef04a000 c06595c0 c05dd6ac 00000000 c00085c8
#3 lore raw

PATCH 2/2 ARM: dt: tegra: harmony: add regulators

In reply to Stephen Warren

From: Laxman Dewangan <[email protected]>

Harmony uses a TPS6586x regulator. Instantiate this, and hook up a couple of fixed GPIO-controlled regulators too.

Based on Ventana regulator patch by Stephen Warren <[email protected]> and converted to Harmony.

[swarren: Remove board-harmony{-power.c,.h} now that they're unused.
Fixed board-harmony-pcie.c to control the 1V5 GPIO using the regulator introduced in the .dts file rather than directly]

---
Note that this depends on a TPS6586x driver patch that I believe Mark Brown will be placing into a branch for the Tegra tree to merge. Also, I haven't boot-tested this, but I hope that Laxman will. If not, I will once I get back from the conference.

 arch/arm/boot/dts/tegra20-harmony.dts     |  210 +++++++++++++++++++++++++++++
 arch/arm/mach-tegra/Makefile              |    1 -
 arch/arm/mach-tegra/board-dt-tegra20.c    |    9 +-
 arch/arm/mach-tegra/board-harmony-pcie.c  |   28 ++--
 arch/arm/mach-tegra/board-harmony-power.c |  144 --------------------
 arch/arm/mach-tegra/board-harmony.h       |   28 ----
 6 files changed, 227 insertions(+), 193 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/board-harmony-power.c
 delete mode 100644 arch/arm/mach-tegra/board-harmony.h
arch/arm/boot/dts/tegra20-harmony.dts +210 -0
index f146dbf..0add02b 100644
@@ -275,6 +275,152 @@
 	i2c at 7000d000 {
 		status = "okay";
 		clock-frequency = <400000>;
+
+		pmic: tps6586x at 34 {
+			compatible = "ti,tps6586x";
+			reg = <0x34>;
+			interrupts = <0 86 0x4>;
+
+			#gpio-cells = <2>;
+			gpio-controller;
+
+			sys-supply = <&vdd_5v0_reg>;
+			vin-sm0-supply = <&sys_reg>;
+			vin-sm1-supply = <&sys_reg>;
+			vin-sm2-supply = <&sys_reg>;
+			vinldo01-supply = <&sm2_reg>;
+			vinldo23-supply = <&sm2_reg>;
+			vinldo4-supply = <&sm2_reg>;
+			vinldo678-supply = <&sm2_reg>;
+			vinldo9-supply = <&sm2_reg>;
+
+			regulators {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				sys_reg: regulator at 0 {
+					reg = <0>;
+					regulator-compatible = "sys";
+					regulator-name = "vdd_sys";
+					regulator-always-on;
+				};
+
+				regulator at 1 {
+					reg = <1>;
+					regulator-compatible = "sm0";
+					regulator-name = "vdd_sm0,vdd_core";
+					regulator-min-microvolt = <1200000>;
+					regulator-max-microvolt = <1200000>;
+					regulator-always-on;
+				};
+
+				regulator at 2 {
+					reg = <2>;
+					regulator-compatible = "sm1";
+					regulator-name = "vdd_sm1,vdd_cpu";
+					regulator-min-microvolt = <1000000>;
+					regulator-max-microvolt = <1000000>;
+					regulator-always-on;
+				};
+
+				sm2_reg: regulator at 3 {
+					reg = <3>;
+					regulator-compatible = "sm2";
+					regulator-name = "vdd_sm2,vin_ldo*";
+					regulator-min-microvolt = <3700000>;
+					regulator-max-microvolt = <3700000>;
+					regulator-always-on;
+				};
+
+				/* LDO0 is not connected to anything */
+
+				regulator at 5 {
+					reg = <5>;
+					regulator-compatible = "ldo1";
+					regulator-name = "vdd_ldo1,avdd_pll*";
+					regulator-min-microvolt = <1100000>;
+					regulator-max-microvolt = <1100000>;
+					regulator-always-on;
+				};
+
+				regulator at 6 {
+					reg = <6>;
+					regulator-compatible = "ldo2";
+					regulator-name = "vdd_ldo2,vdd_rtc";
+					regulator-min-microvolt = <1200000>;
+					regulator-max-microvolt = <1200000>;
+				};
+
+				regulator at 7 {
+					reg = <7>;
+					regulator-compatible = "ldo3";
+					regulator-name = "vdd_ldo3,avdd_usb*";
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
+					regulator-always-on;
+				};
+
+				regulator at 8 {
+					reg = <8>;
+					regulator-compatible = "ldo4";
+					regulator-name = "vdd_ldo4,avdd_osc,vddio_sys";
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+					regulator-always-on;
+				};
+
+				regulator at 9 {
+					reg = <9>;
+					regulator-compatible = "ldo5";
+					regulator-name = "vdd_ldo5,vcore_mmc";
+					regulator-min-microvolt = <2850000>;
+					regulator-max-microvolt = <2850000>;
+					regulator-always-on;
+				};
+
+				regulator at 10 {
+					reg = <10>;
+					regulator-compatible = "ldo6";
+					regulator-name = "vdd_ldo6,avdd_vdac";
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+				};
+
+				regulator at 11 {
+					reg = <11>;
+					regulator-compatible = "ldo7";
+					regulator-name = "vdd_ldo7,avdd_hdmi,vdd_fuse";
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
+				};
+
+				regulator at 12 {
+					reg = <12>;
+					regulator-compatible = "ldo8";
+					regulator-name = "vdd_ldo8,avdd_hdmi_pll";
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+				};
+
+				regulator at 13 {
+					reg = <13>;
+					regulator-compatible = "ldo9";
+					regulator-name = "vdd_ldo9,avdd_2v85,vdd_ddr_rx";
+					regulator-min-microvolt = <2850000>;
+					regulator-max-microvolt = <2850000>;
+					regulator-always-on;
+				};
+
+				regulator at 14 {
+					reg = <14>;
+					regulator-compatible = "ldo_rtc";
+					regulator-name = "vdd_rtc_out,vdd_cell";
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
+					regulator-always-on;
+				};
+			};
+		};
 	};
 
 	pmc {
@@ -310,6 +456,70 @@
 		bus-width = <8>;
 	};
 
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		vdd_5v0_reg: regulator at 0 {
+			compatible = "regulator-fixed";
+			reg = <0>;
+			regulator-name = "vdd_5v0";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			regulator-always-on;
+		};
+
+		regulator at 1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "vdd_1v5";
+			regulator-min-microvolt = <1500000>;
+			regulator-max-microvolt = <1500000>;
+			gpio = <&pmic 0 0>;
+		};
+
+		regulator at 2 {
+			compatible = "regulator-fixed";
+			reg = <2>;
+			regulator-name = "vdd_1v2";
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1200000>;
+			gpio = <&pmic 1 0>;
+			enable-active-high;
+		};
+
+		regulator at 3 {
+			compatible = "regulator-fixed";
+			reg = <3>;
+			regulator-name = "vdd_1v05";
+			regulator-min-microvolt = <10500000>;
+			regulator-max-microvolt = <10500000>;
+			gpio = <&pmic 2 0>;
+			enable-active-high;
+		};
+
+		regulator at 4 {
+			compatible = "regulator-fixed";
+			reg = <4>;
+			regulator-name = "vdd_pnl";
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
+			gpio = <&gpio 22 0>; /* gpio PC6 */
+			enable-active-high;
+		};
+
+		regulator at 5 {
+			compatible = "regulator-fixed";
+			reg = <5>;
+			regulator-name = "vdd_bl";
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
+			gpio = <&gpio 176 0>; /* gpio PW0 */
+			enable-active-high;
+		};
+	};
+
 	sound {
 		compatible = "nvidia,tegra-audio-wm8903-harmony",
 			     "nvidia,tegra-audio-wm8903";
arch/arm/mach-tegra/Makefile +0 -1
index 90a40c3..0e04bc4 100644
@@ -29,6 +29,5 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= board-dt-tegra20.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= board-dt-tegra30.o
 
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= board-harmony-pcie.o
-obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= board-harmony-power.o
 
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= board-paz00.o
arch/arm/mach-tegra/board-dt-tegra20.c +1 -8
index 30f8036..adc6b98 100644
@@ -44,7 +44,6 @@
 #include <mach/usb_phy.h>
 
 #include "board.h"
-#include "board-harmony.h"
 #include "clock.h"
 
 struct tegra_ehci_platform_data tegra_ehci1_pdata = {
@@ -134,15 +133,9 @@ static void __init trimslice_init(void)
 
 static void __init harmony_init(void)
 {
+#ifdef CONFIG_TEGRA_PCI
 	int ret;
 
-	ret = harmony_regulator_init();
-	if (ret) {
-		pr_err("harmony_regulator_init() failed: %d\n", ret);
-		return;
-	}
-
-#ifdef CONFIG_TEGRA_PCI
 	ret = harmony_pcie_init();
 	if (ret)
 		pr_err("harmony_pcie_init() failed: %d\n", ret);
arch/arm/mach-tegra/board-harmony-pcie.c +16 -12
index e8c3fda..662fb20 100644
@@ -23,26 +23,29 @@
 #include <asm/mach-types.h>
 
 #include "board.h"
-#include "board-harmony.h"
 
 #ifdef CONFIG_TEGRA_PCI
 
 int __init harmony_pcie_init(void)
 {
-	struct regulator *regulator = NULL;
+	struct regulator *regulator_1v5, *regulator_pex;
 	int err;
 
-	err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
-	if (err)
-		return err;
+	regulator_1v5 = regulator_get(NULL, "vdd_1v5");
+	if (IS_ERR_OR_NULL(regulator_1v5)) {
+		err = PTR_ERR(regulator_1v5);
+		goto err_reg;
+	}
 
-	gpio_direction_output(TEGRA_GPIO_EN_VDD_1V05_GPIO, 1);
+	regulator_enable(regulator_1v5);
 
-	regulator = regulator_get(NULL, "pex_clk");
-	if (IS_ERR_OR_NULL(regulator))
+	regulator_pex = regulator_get(NULL, "pex_clk");
+	if (IS_ERR_OR_NULL(regulator_pex)) {
+		err = PTR_ERR(regulator_pex);
 		goto err_reg;
+	}
 
-	regulator_enable(regulator);
+	regulator_enable(regulator_pex);
 
 	err = tegra_pcie_init(true, true);
 	if (err)
@@ -51,10 +54,11 @@ int __init harmony_pcie_init(void)
 	return 0;
 
 err_pcie:
-	regulator_disable(regulator);
-	regulator_put(regulator);
+	regulator_disable(regulator_pex);
+	regulator_put(regulator_pex);
 err_reg:
-	gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO);
+	regulator_disable(regulator_1v5);
+	regulator_put(regulator_1v5);
 
 	return err;
 }
arch/arm/mach-tegra/board-harmony-power.c deleted +0 -144

144 lines not on this page · raw message

arch/arm/mach-tegra/board-harmony.h deleted +0 -28
deleted file mode 100644
index 7ae87088..0000000
@@ -1,28 +0,0 @@
-/*
- * arch/arm/mach-tegra/board-harmony.h
- *
- * Copyright (C) 2010 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _MACH_TEGRA_BOARD_HARMONY_H
-#define _MACH_TEGRA_BOARD_HARMONY_H
-
-#include <mach/gpio-tegra.h>
-
-#define HARMONY_GPIO_TPS6586X(_x_)	(TEGRA_NR_GPIOS + (_x_))
-
-#define TEGRA_GPIO_EN_VDD_1V05_GPIO	HARMONY_GPIO_TPS6586X(2)
-
-int harmony_regulator_init(void);
-
-#endif
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 2/2 ARM: dt: tegra: harmony: add regulators

Quoted 9 lines · Stephen Warren
  #include "board.h"
arch/arm/mach-tegra/board-harmony-pcie.c +1 -2
-#include "board-harmony.h"
 
  #ifdef CONFIG_TEGRA_PCI
 
  int __init harmony_pcie_init(void)
  {
-       struct regulator *regulator = NULL;
+       struct regulator *regulator_1v5, *regulator_pex;

arch/arm/mach-tegra/board-harmony-pcie.c line 38

Quoted 10 lines
arch/arm/mach-tegra/board-harmony-pcie.c +5 -3
         int err;
 
-       err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
-       if (err)
-               return err;
+       regulator_1v5 = regulator_get(NULL, "vdd_1v5");
+       if (IS_ERR_OR_NULL(regulator_1v5)) {
+               err = PTR_ERR(regulator_1v5);
+               goto err_reg;
+       }

You need to return in case of err otherwise it will cause the crash in regulator_disable() with NULL argument.

#5 lore raw

PATCH 2/2 ARM: dt: tegra: harmony: add regulators

Quoted 21 lines · Laxman Dewangan
Quoted 9 lines · Stephen Warren
  #include "board.h"
arch/arm/mach-tegra/board-harmony-pcie.c +1 -2
-#include "board-harmony.h"
 
  #ifdef CONFIG_TEGRA_PCI
 
  int __init harmony_pcie_init(void)
  {
-       struct regulator *regulator = NULL;
+       struct regulator *regulator_1v5, *regulator_pex;

arch/arm/mach-tegra/board-harmony-pcie.c line 38

Quoted 10 lines
arch/arm/mach-tegra/board-harmony-pcie.c +5 -3
         int err;
 
-       err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
-       if (err)
-               return err;
+       regulator_1v5 = regulator_get(NULL, "vdd_1v5");
+       if (IS_ERR_OR_NULL(regulator_1v5)) {
+               err = PTR_ERR(regulator_1v5);
+               goto err_reg;
+       }
Quoted 2 lines

You need to return in case of err otherwise it will cause the crash in regulator_disable() with NULL argument.

OK, I think I've fixed this and the crash, and re-pushed my personal linux-next_common. I don't suppose you could retest this. Thanks very much!