Skip to contentSkip to conversation

Harmony PCI-e and regulators

PATCH Superseded Mike Rapoport 4 participants 16 messages Mar 8, 2011 – Mar 9, 2011

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Harmony PCI-e and regulators

These patches provide update for Harmony PCI-e intialization and add registration of the TPS65862 PMIC.
Additionally, there are several tegra_defconfig updates. These updates allow booting the Harmony with PCI-e enabled and add ability to boot TrimSlice with root on NFS.

The patches were generated vs. Olof's board-for-next-i2c that seems to disappear. If there are now objection to these patches I can push them into separate branch in my tree, so that it can be pulled after Tegra I2C is merged.

Mike Rapoport (3):
ARM: tegra: harmony: update PCI-e initialization sequence
ARM: tegra: harmony: initialize the TPS65862 PMIC
ARM: tegra: update defconfig

 arch/arm/configs/tegra_defconfig          |   12 ++-
 arch/arm/mach-tegra/Makefile              |    1 +
 arch/arm/mach-tegra/board-harmony-pcie.c  |   24 ++++-
 arch/arm/mach-tegra/board-harmony-power.c |  161 +++++++++++++++++++++++++++++
 arch/arm/mach-tegra/board-harmony.c       |    1 +
 arch/arm/mach-tegra/board-harmony.h       |    1 +
 6 files changed, 197 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-tegra/board-harmony-power.c
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/3 ARM: tegra: harmony: update PCI-e initialization sequence

On Harmony board PCI-e subsystem can be enabled only after certain voltage regulators are on. One of the regulators is an internal regulator on the PMIC and another one is controlled by a PMIC GPIO. Addition of the voltage control to the Harmony PCI-e initialization allows booting of kernel with CONFIG_TEGRA_PCI even if the PMIC driver is not loaded. In this case the PCI-e initialization will fail gracefully intead of hanging the system.

---
 arch/arm/mach-tegra/board-harmony-pcie.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/board-harmony-pcie.c +23 -1
index f7e7d45..9c27b95 100644
@@ -27,13 +27,29 @@
 
 #ifdef CONFIG_TEGRA_PCI
 
+/* GPIO 3 of the PMIC */
+#define EN_VDD_1V05_GPIO	(TEGRA_NR_GPIOS + 2)
+
 static int __init harmony_pcie_init(void)
 {
+	struct regulator *regulator = NULL;
 	int err;
 
 	if (!machine_is_harmony())
 		return 0;
 
+	err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05");
+	if (err)
+		return err;
+
+	gpio_direction_output(EN_VDD_1V05_GPIO, 1);
+
+	regulator = regulator_get(NULL, "pex_clk");
+	if (IS_ERR_OR_NULL(regulator))
+		goto err_reg;
+
+	regulator_enable(regulator);
+
 	tegra_pinmux_set_tristate(TEGRA_PINGROUP_GPV, TEGRA_TRI_NORMAL);
 	tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_NORMAL);
 	tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_NORMAL);
@@ -49,9 +65,15 @@ err_pcie:
 	tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_TRISTATE);
 	tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_TRISTATE);
 
+	regulator_disable(regulator);
+	regulator_put(regulator);
+err_reg:
+	gpio_free(EN_VDD_1V05_GPIO);
+
 	return err;
 }
 
-subsys_initcall(harmony_pcie_init);
+/* PCI should be initialized after I2C, mfd and regulators */
+subsys_initcall_sync(harmony_pcie_init);
 
 #endif
Signature · 1 line
1.7.3.1
#2 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

In reply to Mike Rapoport
---
 arch/arm/mach-tegra/Makefile              |    1 +
 arch/arm/mach-tegra/board-harmony-power.c |  161 +++++++++++++++++++++++++++++
 arch/arm/mach-tegra/board-harmony.c       |    1 +
 arch/arm/mach-tegra/board-harmony.h       |    1 +
 4 files changed, 164 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-tegra/board-harmony-power.c
arch/arm/mach-tegra/Makefile +1 -0
index 9bf39fa..cdc4788 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_TEGRA_PCI)			+= pcie.o
 obj-${CONFIG_MACH_HARMONY}              += board-harmony.o
 obj-${CONFIG_MACH_HARMONY}              += board-harmony-pinmux.o
 obj-${CONFIG_MACH_HARMONY}              += board-harmony-pcie.o
+obj-${CONFIG_MACH_HARMONY}              += board-harmony-power.o
 
 obj-${CONFIG_MACH_SEABOARD}             += board-seaboard.o
 obj-${CONFIG_MACH_SEABOARD}             += board-seaboard-pinmux.o
arch/arm/mach-tegra/board-harmony-power.c new file +161 -0

161 lines not on this page · raw message

arch/arm/mach-tegra/board-harmony.c +1 -0
index 2d7d9d9..7de4a7e 100644
@@ -147,6 +147,7 @@ static void __init tegra_harmony_init(void)
 
 	platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
 	harmony_i2c_init();
+	harmony_regulator_init();
 }
 
 MACHINE_START(HARMONY, "harmony")
arch/arm/mach-tegra/board-harmony.h +1 -0
index 09ca775..0a69661 100644
@@ -18,5 +18,6 @@
 #define _MACH_TEGRA_BOARD_HARMONY_H
 
 void harmony_pinmux_init(void);
+int harmony_regulator_init(void);
 
 #endif
Signature · 1 line
1.7.3.1
#3 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

arch/arm/mach-tegra/board-harmony-power.c line 52

Quoted 3 lines · Mike Rapoport
arch/arm/mach-tegra/board-harmony-power.c new file +3 -0
+static struct regulator_consumer_supply tps658621_ldo2_supply[] = {
+	REGULATOR_SUPPLY("vdd_rtc", NULL),
+};

I feel sure that some of these could be using a struct device, though since they're probably all going to be required to be always on I'd expect it's not useful to have them mapped as supplies at all and the drivers could just assume they were there.

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define REGULATOR_INIT(_id, _minmv, _maxmv)				\
+	{								\

This should be namespaced, someone might add a generic macro with that name.

#4 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 10 lines · Mark Brown

arch/arm/mach-tegra/board-harmony-power.c line 52

Quoted 3 lines · Mike Rapoport
arch/arm/mach-tegra/board-harmony-power.c new file +3 -0
+static struct regulator_consumer_supply tps658621_ldo2_supply[] = {
+	REGULATOR_SUPPLY("vdd_rtc", NULL),
+};

I feel sure that some of these could be using a struct device, though since they're probably all going to be required to be always on I'd expect it's not useful to have them mapped as supplies at all and the drivers could just assume they were there.

I'd prefer to keep it as is for now and update the supplies when merging the drivers that actually use them.

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define REGULATOR_INIT(_id, _minmv, _maxmv)				\
+	{								\

This should be namespaced, someone might add a generic macro with that name.

Ok, will fix.

Signature · 2 lines
Sincerely yours,
Mike.
#5 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 9 lines · Mike Rapoport
Quoted 4 lines · Mark Brown

I feel sure that some of these could be using a struct device, though since they're probably all going to be required to be always on I'd expect it's not useful to have them mapped as supplies at all and the drivers could just assume they were there.

I'd prefer to keep it as is for now and update the supplies when merging the drivers that actually use them.

There's no point in keepig them if they don't match up with the actual drivers and having this sort of stuff in the kernel means it might get picked up as reference code by other users. If you want to label the supplies to match the rails on the board the name field in constraints is intended for that purpose.

#6 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 8 lines · Mark Brown
Quoted 6 lines · Mike Rapoport
Quoted 4 lines · Mark Brown

I feel sure that some of these could be using a struct device, though since they're probably all going to be required to be always on I'd expect it's not useful to have them mapped as supplies at all and the drivers could just assume they were there.

Quoted 8 lines
Quoted 2 lines

I'd prefer to keep it as is for now and update the supplies when merging the drivers that actually use them.

There's no point in keepig them if they don't match up with the actual drivers and having this sort of stuff in the kernel means it might get picked up as reference code by other users. If you want to label the supplies to match the rails on the board the name field in constraints is intended for that purpose.

As for me, I'd be fine with registering only the pex_clk supply and ldo0 to allow PCI-e on Harmony :)
If Tegra folks are Ok with it, I'd drop the rest and we'll add more regulators and supplies together with drivers that use them.

Signature · 2 lines
Sincerely yours,
Mike.
#7 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 4 lines · Mike Rapoport

As for me, I'd be fine with registering only the pex_clk supply and ldo0 to allow PCI-e on Harmony :)
If Tegra folks are Ok with it, I'd drop the rest and we'll add more regulators and supplies together with drivers that use them.

Note that there's no issue with having no supplies set for a regulator so no reason not to register the supplies themselves, it's just the supply map that I was flagging.

#8 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 10 lines · Mark Brown
Quoted 4 lines · Mike Rapoport

As for me, I'd be fine with registering only the pex_clk supply and ldo0 to allow PCI-e on Harmony :)
If Tegra folks are Ok with it, I'd drop the rest and we'll add more regulators and supplies together with drivers that use them.

Note that there's no issue with having no supplies set for a regulator so no reason not to register the supplies themselves, it's just the supply map that I was flagging.

I.e. having something like

static struct regulator_consumer_supply tps658621_ldo7_supply[] = { };

instead of

static struct regulator_consumer_supply tps658621_ldo7_supply[] = {
REGULATOR_SUPPLY("avdd_hdmi", NULL), REGULATOR_SUPPLY("vdd_fuse", NULL),
};

?

Quoted 4 lines

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

Signature · 2 lines
Sincerely yours,
Mike.
#9 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 10 lines · Mike Rapoport
Quoted 3 lines · Mark Brown

Note that there's no issue with having no supplies set for a regulator so no reason not to register the supplies themselves, it's just the supply map that I was flagging.

I.e. having something like

static struct regulator_consumer_supply tps658621_ldo7_supply[] = { };

Well, I'd just omit the array entirely if it's empty but yes.

#10 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 7 lines · Mark Brown
Quoted 5 lines · Mike Rapoport
Quoted 3 lines · Mark Brown

Note that there's no issue with having no supplies set for a regulator so no reason not to register the supplies themselves, it's just the supply map that I was flagging.

Quoted 6 lines
Quoted 4 lines

I.e. having something like

static struct regulator_consumer_supply tps658621_ldo7_supply[] = { };

Well, I'd just omit the array entirely if it's empty but yes.

This would break nice un-namespaced REGULATOR_INIT macros :)

Quoted 4 lines

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

Signature · 2 lines
Sincerely yours,
Mike.
#11 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

In reply to Mike Rapoport

Hi Mike,

Am Dienstag 08 M?rz 2011, um 13:58:58 schrieb Mike Rapoport:

Quoted 8 lines
---
 arch/arm/mach-tegra/Makefile              |    1 +
 arch/arm/mach-tegra/board-harmony-power.c |  161 +++++++++++++++++++++++++++++
 arch/arm/mach-tegra/board-harmony.c       |    1 +
 arch/arm/mach-tegra/board-harmony.h       |    1 +
 4 files changed, 164 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-tegra/board-harmony-power.c

...

Quoted 6 lines
arch/arm/mach-tegra/board-harmony-power.c new file +0 -0
new file mode 100644
index 0000000..ca43d7a

...

arch/arm/mach-tegra/board-harmony-power.c line 158

Quoted 11 lines
arch/arm/mach-tegra/board-harmony-power.c new file +11 -0
+static struct i2c_board_info __initdata harmony_regulators[] = {
+	{
+		I2C_BOARD_INFO("tps6586x", 0x34),
+		.irq		= INT_EXTERNAL_PMU,
+		.platform_data	= &tps_platform,
+	},
+};
+
+int __init harmony_regulator_init(void)
+{
+	i2c_register_board_info(3, harmony_regulators, 1);

I don't know harmony well, but are you sure this is 3, not 4, as on all other boards?

Marc

#12 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 20 lines · Marc Dietrich

Hi Mike,

Am Dienstag 08 M?rz 2011, um 13:58:58 schrieb Mike Rapoport:

Quoted 8 lines
---
 arch/arm/mach-tegra/Makefile              |    1 +
 arch/arm/mach-tegra/board-harmony-power.c |  161 +++++++++++++++++++++++++++++
 arch/arm/mach-tegra/board-harmony.c       |    1 +
 arch/arm/mach-tegra/board-harmony.h       |    1 +
 4 files changed, 164 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-tegra/board-harmony-power.c

...

Quoted 6 lines
arch/arm/mach-tegra/board-harmony-power.c new file +0 -0
new file mode 100644
index 0000000..ca43d7a

...

Quoted 13 lines

arch/arm/mach-tegra/board-harmony-power.c line 158

Quoted 11 lines
arch/arm/mach-tegra/board-harmony-power.c new file +11 -0
+static struct i2c_board_info __initdata harmony_regulators[] = {
+	{
+		I2C_BOARD_INFO("tps6586x", 0x34),
+		.irq		= INT_EXTERNAL_PMU,
+		.platform_data	= &tps_platform,
+	},
+};
+
+int __init harmony_regulator_init(void)
+{
+	i2c_register_board_info(3, harmony_regulators, 1);

I don't know harmony well, but are you sure this is 3, not 4, as on all other boards?

In the mainline version of i2c-tegra the adapter (and therefore bus) number equals the platform device id, and in case of DVC adapter it's 3.

Quoted 2 lines

Marc

Signature · 2 lines
Sincerely yours,
Mike.
#13 lore raw

PATCH 2/3 ARM: tegra: harmony: initialize the TPS65862 PMIC

Quoted 23 lines · Marc Dietrich
Quoted 8 lines

Am Dienstag 08 M?rz 2011, um 13:58:58 schrieb Mike Rapoport:

Quoted 6 lines
arch/arm/mach-tegra/board-harmony-power.c new file +0 -0
new file mode 100644
index 0000000..ca43d7a

...

Quoted 13 lines

arch/arm/mach-tegra/board-harmony-power.c line 158

Quoted 11 lines
arch/arm/mach-tegra/board-harmony-power.c new file +11 -0
+static struct i2c_board_info __initdata harmony_regulators[] = {
+	{
+		I2C_BOARD_INFO("tps6586x", 0x34),
+		.irq		= INT_EXTERNAL_PMU,
+		.platform_data	= &tps_platform,
+	},
+};
+
+int __init harmony_regulator_init(void)
+{
+	i2c_register_board_info(3, harmony_regulators, 1);

I don't know harmony well, but are you sure this is 3, not 4, as on all other boards?

Quoted 2 lines

In the mainline version of i2c-tegra the adapter (and therefore bus) number equals the platform device id, and in case of DVC adapter it's 3.

Thanks for clarification. I guess this saved me from some headaches.

Marc

#14 lore raw

PATCH 3/3 ARM: tegra: update defconfig

In reply to Mike Rapoport

* Enable TPS6586x PMIC driver
* Enable RealTek 8169 used on TrimSlice
* Allow booting with root on NFS

---
 arch/arm/configs/tegra_defconfig |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/configs/tegra_defconfig +10 -2
index 294235f..8727c0c 100644
@@ -43,6 +43,10 @@ CONFIG_PACKET=y
 CONFIG_UNIX=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
 CONFIG_INET_ESP=y
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
@@ -69,7 +73,7 @@ CONFIG_APDS9802ALS=y
 CONFIG_ISL29003=y
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=y
-# CONFIG_NETDEV_1000 is not set
+CONFIG_R8169=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_WLAN is not set
 # CONFIG_INPUT is not set
@@ -88,7 +92,9 @@ CONFIG_I2C_TEGRA=y
 CONFIG_POWER_SUPPLY=y
 CONFIG_BATTERY_BQ20Z75=y
 CONFIG_SENSORS_LM90=y
-# CONFIG_MFD_SUPPORT is not set
+CONFIG_MFD_TPS6586X=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_TPS6586X=y
 # CONFIG_USB_SUPPORT is not set
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
@@ -110,6 +116,8 @@ CONFIG_EXT3_FS_SECURITY=y
 # CONFIG_DNOTIFY is not set
 CONFIG_VFAT_FS=y
 CONFIG_TMPFS=y
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_EFI_PARTITION=y
 CONFIG_NLS_CODEPAGE_437=y
Signature · 1 line
1.7.3.1
#15 lore raw

cover Harmony PCI-e and regulators

In reply to Mike Rapoport

Hi,

Quoted 10 lines · Mike Rapoport

These patches provide update for Harmony PCI-e intialization and add registration of the TPS65862 PMIC.
Additionally, there are several tegra_defconfig updates. These updates allow booting the Harmony with PCI-e enabled and add ability to boot TrimSlice with root on NFS.

The patches were generated vs. Olof's board-for-next-i2c that seems to disappear. If there are now objection to these patches I can push them into separate branch in my tree, so that it can be pulled after Tegra I2C is merged.

Given the discussion yesterday, I merged what was essentially in the -i2c branch into the regular boards-for-next branch. I can take these through the same branch, since Colin hasn't pulled yet.

-Olof