Skip to contentSkip to conversation

am43xx: Only read the MPU frequency bits of CTRL_DEV_ATTR

PATCH New Tom Rini 1 participant 8 messages Jun 5, 2014 – Jun 6, 2014 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/4 am43xx: Only read the MPU frequency bits of CTRL_DEV_ATTR

---
 board/ti/am43xx/board.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
board/ti/am43xx/board.c +4 -1
index d358ad8..e05a50b 100644
@@ -464,7 +464,10 @@ static u32 get_sys_clk_index(void)
 static int get_opp_offset(int max_off, int min_off)
 {
 	struct ctrl_stat *ctrl = (struct ctrl_stat *)CTRL_BASE;
-	int opp = readl(&ctrl->dev_attr), offset, i;
+	int opp, offset, i;
+
+	/* Bits 0:11 are defined to be the MPU_MAX_FREQ */
+	opp = readl(&ctrl->dev_attr) & ~0xFFFFF000;
 
 	for (i = max_off; i >= min_off; i--) {
 		offset = opp & (1 << i);
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/4 arm:am33xx: Add a scale_vcores() hook

Similar to OMAP4/5 we need to scale the voltage up prior to changing the clock frequencies up higher. Add a similar hook to start with.

---
 arch/arm/cpu/armv7/am33xx/clock.c        |   11 +++++++++++
 arch/arm/include/asm/arch-am33xx/clock.h |    1 +
 2 files changed, 12 insertions(+)
arch/arm/cpu/armv7/am33xx/clock.c +11 -0
index 0672798..ec7d468 100644
@@ -170,8 +170,19 @@ void do_enable_clocks(u32 *const *clk_domains,
 	};
 }
 
+/*
+ * Before scaling up the clocks we need to have the PMIC scale up the
+ * voltages first.  This will be dependent on which PMIC is in use
+ * and in some cases we may not be scaling things up at all and thus not
+ * need to do anything here.
+ */
+__weak void scale_vcores(void)
+{
+}
+
 void prcm_init()
 {
 	enable_basic_clocks();
+	scale_vcores();
 	setup_dplls();
 }
arch/arm/include/asm/arch-am33xx/clock.h +1 -0
index f00fad3..4af6b57 100644
@@ -107,6 +107,7 @@ const struct dpll_params *get_dpll_mpu_params(void);
 const struct dpll_params *get_dpll_core_params(void);
 const struct dpll_params *get_dpll_per_params(void);
 const struct dpll_params *get_dpll_ddr_params(void);
+void scale_vcores(void);
 void do_setup_dpll(const struct dpll_regs *, const struct dpll_params *);
 void prcm_init(void);
 void enable_basic_clocks(void);
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH 3/4 power: Add support for the TPS65218 PMIC

In reply to Tom Rini

Add a driver for the TPS65218 PMIC which is used by TI AM43xx SoCs and may be used by TI AM335x SoCs.

---
 drivers/power/pmic/Makefile        |    1 +
 drivers/power/pmic/pmic_tps65218.c |   97 ++++++++++++++++++++++++++++++++++++
 include/power/tps65218.h           |   63 +++++++++++++++++++++++
 3 files changed, 161 insertions(+)
 create mode 100644 drivers/power/pmic/pmic_tps65218.c
 create mode 100644 include/power/tps65218.h
drivers/power/pmic/Makefile +1 -0
index 920bbdc..192df50 100644
@@ -12,4 +12,5 @@ obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 obj-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
 obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
 obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
+obj-$(CONFIG_POWER_TPS65218) += pmic_tps65218.o
 obj-$(CONFIG_POWER_TPS65910) += pmic_tps65910.o
drivers/power/pmic/pmic_tps65218.c new file +97 -0

97 lines not on this page · raw message

include/power/tps65218.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH 4/4 arm:am43xx: Add TPS65218 support to scale voltages up

In reply to Tom Rini

This family is supported by the TPS65218 PMIC. Implement a scale_vcores to set the MPU and CORE voltage correctly to the max frequency that is supported (and what we will be scaling them to in setup_dplls()).

---
 board/ti/am43xx/board.c      |   48 ++++++++++++++++++++++++++++++++++++------
 include/configs/am43xx_evm.h |    4 ++++
 2 files changed, 45 insertions(+), 7 deletions(-)
board/ti/am43xx/board.c +41 -7
index e05a50b..7786903 100644
@@ -19,6 +19,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/emif.h>
 #include "board.h"
+#include <power/tps65218.h>
 #include <miiphy.h>
 #include <cpsw.h>
 
@@ -416,13 +417,6 @@ void emif_get_ext_phy_ctrl_const_regs(const u32 **regs, u32 *size)
 
 const struct dpll_params *get_dpll_ddr_params(void)
 {
-	struct am43xx_board_id header;
-
-	enable_i2c0_pin_mux();
-	i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
-	if (read_eeprom(&header) < 0)
-		puts("Could not get board ID.\n");
-
 	if (board_is_eposevm())
 		return &epos_evm_dpll_ddr;
 	else if (board_is_gpevm() || board_is_sk())
@@ -500,6 +494,46 @@ const struct dpll_params *get_dpll_per_params(void)
 	return &dpll_per[ind];
 }
 
+void scale_vcores(void)
+{
+	const struct dpll_params *mpu_params;
+	int mpu_vdd;
+	struct am43xx_board_id header;
+
+	enable_i2c0_pin_mux();
+	i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
+	if (read_eeprom(&header) < 0)
+		puts("Could not get board ID.\n");
+
+	/* Get the frequency */
+	mpu_params = get_dpll_mpu_params();
+
+	if (i2c_probe(TPS65218_CHIP_PM))
+		return;
+
+	if (mpu_params->m == 1000) {
+		mpu_vdd = TPS65218_DCDC_VOLT_SEL_1330MV;
+	} else if (mpu_params->m == 600) {
+		mpu_vdd = TPS65218_DCDC_VOLT_SEL_1100MV;
+	} else {
+		puts("Unknown MPU clock, not scaling\n");
+		return;
+	}
+
+	/* Set DCDC1 (CORE) voltage to 1.1V */
+	if (tps65218_voltage_update(TPS65218_DCDC1,
+				    TPS65218_DCDC_VOLT_SEL_1100MV)) {
+		puts("tps65218_voltage_update failure\n");
+		return;
+	}
+
+	/* Set DCDC2 (MPU) voltage */
+	if (tps65218_voltage_update(TPS65218_DCDC2, mpu_vdd)) {
+		puts("tps65218_voltage_update failure\n");
+		return;
+	}
+}
+
 void set_uart_mux_conf(void)
 {
 	enable_uart0_pin_mux();
include/configs/am43xx_evm.h +4 -0
index 470fa39..2e19c17 100644
@@ -32,11 +32,15 @@
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	2
 #define CONFIG_SYS_I2C_MULTI_EEPROMS
 
+/* Power */
+#define CONFIG_POWER_TPS65218
+
 /* SPL defines. */
 #define CONFIG_SPL_TEXT_BASE		0x40300350
 #define CONFIG_SPL_MAX_SIZE		(220 << 10)	/* 220KB */
 #define CONFIG_SYS_SPL_ARGS_ADDR	(CONFIG_SYS_SDRAM_BASE + \
 					 (128 << 20))
+#define CONFIG_SPL_POWER_SUPPORT
 #define CONFIG_SPL_YMODEM_SUPPORT
 
 /* Enabling L2 Cache */
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/4 am43xx: Only read the MPU frequency bits of CTRL_DEV_ATTR

In reply to Tom Rini
Quoted 1 line · Tom Rini

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140606/fc7099b7/attachment-0001.pgp>
author
#3 lore raw

PATCH 2/4 arm:am33xx: Add a scale_vcores() hook

In reply to Tom Rini
Quoted 4 lines · Tom Rini

Similar to OMAP4/5 we need to scale the voltage up prior to changing the clock frequencies up higher. Add a similar hook to start with.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140606/5a0c923e/attachment.pgp>
author
#5 lore raw

PATCH 3/4 power: Add support for the TPS65218 PMIC

In reply to Tom Rini
Quoted 4 lines · Tom Rini

Add a driver for the TPS65218 PMIC which is used by TI AM43xx SoCs and may be used by TI AM335x SoCs.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140606/2a12f3cb/attachment.pgp>
author
#7 lore raw

PATCH 4/4 arm:am43xx: Add TPS65218 support to scale voltages up

In reply to Tom Rini
Quoted 5 lines · Tom Rini

This family is supported by the TPS65218 PMIC. Implement a scale_vcores to set the MPU and CORE voltage correctly to the max frequency that is supported (and what we will be scaling them to in setup_dplls()).

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140606/4d7e339d/attachment.pgp>