Skip to contentSkip to conversation

spl/Makefile: Add drivers/power/pmic/libpmic to CONFIG_SPL_POWER_SUPPORT

PATCH New Tom Rini 1 participant 7 messages Aug 30, 2013 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/6 spl/Makefile: Add drivers/power/pmic/libpmic to CONFIG_SPL_POWER_SUPPORT

We may need to access the PMIC code in SPL, when we have power set.

---
 spl/Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
spl/Makefile +2 -1
index 339e5e8..65615cb 100644
@@ -87,7 +87,8 @@ LIBS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/libspi_flash.o
 LIBS-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/libspi.o
 LIBS-$(CONFIG_SPL_FAT_SUPPORT) += fs/fat/libfat.o
 LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o
-LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o
+LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o \
+	drivers/power/pmic/libpmic.o
 LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/libnand.o
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/libonenand.o
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/libdma.o
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/6 spl/Makefile: Add drivers/power/pmic/libpmic to CONFIG_SPL_POWER_SUPPORT

Quoted 3 lines · Tom Rini

We may need to access the PMIC code in SPL, when we have power set.

Bah, forgot to pass --subject-prefix 'PATCH v4' to the whole series...

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/20130830/dab4c12e/attachment.pgp>
author
#2 lore raw

PATCH 2/6 drivers/power/pmic: Add tps65217 driver

In reply to Tom Rini

From: Greg Guyotte <[email protected]>

Add a driver for the TPS65217 PMIC that is found in the Beaglebone family of boards.

[trini: Split and rework Greg's changes into new drivers/power framework]

---
Changes in v4:
- Use enum for registers

Changes in v2:
- Address Dan's comments
- Change to SPDX license tag
- Add TRM link in the header

---
 drivers/power/pmic/Makefile        |    1 +
 drivers/power/pmic/pmic_tps65217.c |  109 ++++++++++++++++++++++++++++++++++++
 include/power/tps65217.h           |   82 +++++++++++++++++++++++++++
 3 files changed, 192 insertions(+)
 create mode 100644 drivers/power/pmic/pmic_tps65217.c
 create mode 100644 include/power/tps65217.h
drivers/power/pmic/Makefile +1 -0
index f054470..ac2b625 100644
@@ -13,6 +13,7 @@ COBJS-$(CONFIG_POWER_MAX8998) += pmic_max8998.o
 COBJS-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
 COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 COBJS-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
+COBJS-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/power/pmic/pmic_tps65217.c new file +109 -0

109 lines not on this page · raw message

include/power/tps65217.h new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 3/6 drivers/power/pmic: Add tps65910 driver

In reply to Tom Rini

From: "Philip, Avinash" <[email protected]>

Add a driver for the TPS65910 PMIC that is found in the AM335x GP EVM, AM335x EVM SK and others.

[trini: Split and rework Avinash's changes into new drivers/power framework]

---
Changes in v4:
- Use enum for registers

Changes in v2:
- Change to SPDX license tag
- Add TRM link in the header
- Add tps65910_set_i2c_control()

---
 drivers/power/pmic/Makefile        |    1 +
 drivers/power/pmic/pmic_tps65910.c |   83 ++++++++++++++++++++++++++++++++++++
 include/power/tps65910.h           |   77 +++++++++++++++++++++++++++++++++
 3 files changed, 161 insertions(+)
 create mode 100644 drivers/power/pmic/pmic_tps65910.c
 create mode 100644 include/power/tps65910.h
drivers/power/pmic/Makefile +1 -0
index ac2b625..11b3d03 100644
@@ -14,6 +14,7 @@ COBJS-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
 COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 COBJS-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
 COBJS-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
+COBJS-$(CONFIG_POWER_TPS65910) += pmic_tps65910.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/power/pmic/pmic_tps65910.c new file +83 -0

83 lines not on this page · raw message

include/power/tps65910.h new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH 4/6 am33xx: Add am33xx_spl_board_init function, call

In reply to Tom Rini

We need to allow for a further call-out in spl_board_init. Call this am33xx_spl_board_init and add a __weak version. This function may be used to scale the MPU frequency up, depending on board needs.

---
Changes in v2:
- Move am33xx_spl_board_init to am33xx/board.c from omap-common/boot-common.c

---
 arch/arm/cpu/armv7/am33xx/board.c            |    9 +++++++++
 arch/arm/cpu/armv7/omap-common/boot-common.c |    3 +++
 arch/arm/include/asm/arch-am33xx/sys_proto.h |    1 +
 3 files changed, 13 insertions(+)
arch/arm/cpu/armv7/am33xx/board.c +9 -0
index 2ea3d69..05a2d28 100644
@@ -27,6 +27,7 @@
 #include <miiphy.h>
 #include <cpsw.h>
 #include <asm/errno.h>
+#include <linux/compiler.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/musb.h>
@@ -137,6 +138,14 @@ int arch_misc_init(void)
 }
 
 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
+/*
+ * This function is the place to do per-board things such as ramp up the
+ * MPU clock frequency.
+ */
+__weak void am33xx_spl_board_init(void)
+{
+}
+
 static void rtc32k_enable(void)
 {
 	struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE;
arch/arm/cpu/armv7/omap-common/boot-common.c +3 -0
index 6b4772b..0ffa03a 100644
@@ -76,6 +76,9 @@ void spl_board_init(void)
 #if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)
 	arch_misc_init();
 #endif
+#ifdef CONFIG_AM33XX
+	am33xx_spl_board_init();
+#endif
 }
 
 int board_mmc_init(bd_t *bis)
arch/arm/include/asm/arch-am33xx/sys_proto.h +1 -0
index c6070a3..55f57ac 100644
@@ -42,4 +42,5 @@ u32 wait_on_value(u32, u32, void *, u32);
 #ifdef CONFIG_NOR_BOOT
 void enable_norboot_pin_mux(void);
 #endif
+void am33xx_spl_board_init(void);
 #endif
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH 5/6 am33xx: Add the efuse_sma CONTROL_MODULE register

In reply to Tom Rini

Starting with PG2.1 we have a register in the CONTROL_MODULE that is set with the package type and maximum supported frequency. Add this, and the relevant mask/values.

---
 arch/arm/include/asm/arch-am33xx/cpu.h |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/include/asm/arch-am33xx/cpu.h +12 -0
index 10b56e0..d8a8ffc 100644
@@ -38,6 +38,16 @@
 #define AM335X				0xB944
 #define TI81XX				0xB81E
 #define DEVICE_ID			(CTRL_BASE + 0x0600)
+#define DEVICE_ID_MASK			0x1FFF
+
+/* MPU max frequencies */
+#define AM335X_ZCZ_300			0x1FEF
+#define AM335X_ZCZ_600			0x1FAF
+#define AM335X_ZCZ_720			0x1F2F
+#define AM335X_ZCZ_800			0x1E2F
+#define AM335X_ZCZ_1000			0x1C2F
+#define AM335X_ZCE_300			0x1FDF
+#define AM335X_ZCE_600			0x1F9F
 
 /* This gives the status of the boot mode pins on the evm */
 #define SYSBOOT_MASK			(BIT(0) | BIT(1) | BIT(2)\
@@ -485,6 +495,8 @@ struct ctrl_dev {
 	unsigned int macid1h;		/* offset 0x3c */
 	unsigned int resv4[4];
 	unsigned int miisel;		/* offset 0x50 */
+	unsigned int resv5[106];
+	unsigned int efuse_sma;		/* offset 0x1FC */
 };
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL_STRICT_NAMES */
Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH 6/6 am335x_evm: am33xx_spl_board_init function and scale core frequency

In reply to Tom Rini

Add a am33xx_spl_board_init (and enable the PMICs) that we may see, depending on the board we are running on. In all cases, we see if we can rely on the efuse_sma register to tell us the maximum speed. In the case of Beaglebone White, we need to make sure we are on AC power, and are on later than rev A1, and then we can ramp up to the PG1.0 maximum of 720Mhz. In the case of Beaglebone Black, we are either on PG2.0 that supports 1GHz or PG2.1. As PG2.0 may or may not have efuse_sma set, we cannot rely on this probe. In the case of the GP EVM, EVM SK and IDK we need to rely on the efuse_sma if we are on PG2.1, and the defaults for PG1.0/2.0.

---
Changes in v4:
- Adapt to current frameworks in am33xx

Changes in v3:
- Set sil_rev in tps65910 case

Changes in v2:
- Re-work into helper functions to determine max clock frequency, move tps65910 probe / update into pmic_tps65910.c

---
 arch/arm/cpu/armv7/am33xx/sys_info.c             |   57 +++++++++
 arch/arm/include/asm/arch-am33xx/clocks_am33xx.h |   10 +-
 arch/arm/include/asm/arch-am33xx/sys_proto.h     |    3 +
 board/ti/am335x/board.c                          |  134 ++++++++++++++++++++++
 include/configs/am335x_evm.h                     |    5 +
 5 files changed, 208 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/am33xx/sys_info.c +57 -0
index 63afaaa..fbc01ac 100644
@@ -17,6 +17,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clock.h>
+#include <power/tps65910.h>
 
 struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
 
@@ -119,3 +120,59 @@ int print_cpuinfo(void)
 	return 0;
 }
 #endif	/* CONFIG_DISPLAY_CPUINFO */
+
+#ifdef CONFIG_AM33XX
+int am335x_get_efuse_mpu_max_freq(struct ctrl_dev *cdev)
+{
+	int sil_rev;
+
+	sil_rev = readl(cdev->deviceid) >> 28;
+
+	if (sil_rev == 1)
+		/* PG 2.0, efuse may not be set. */
+		return MPUPLL_M_800;
+	else if (sil_rev >= 2) {
+		/* Check what the efuse says our max speed is. */
+		int efuse_arm_mpu_max_freq;
+		efuse_arm_mpu_max_freq = readl(cdev->efuse_sma);
+		switch ((efuse_arm_mpu_max_freq & DEVICE_ID_MASK)) {
+		case AM335X_ZCZ_1000:
+			return MPUPLL_M_1000;
+		case AM335X_ZCZ_800:
+			return MPUPLL_M_800;
+		case AM335X_ZCZ_720:
+			return MPUPLL_M_720;
+		case AM335X_ZCZ_600:
+		case AM335X_ZCE_600:
+			return MPUPLL_M_600;
+		case AM335X_ZCZ_300:
+		case AM335X_ZCE_300:
+			return MPUPLL_M_300;
+		}
+	}
+
+	/* PG 1.0 or otherwise unknown, use the PG1.0 max */
+	return MPUPLL_M_720;
+}
+
+int am335x_get_tps65910_mpu_vdd(int sil_rev, int frequency)
+{
+	/* For PG2.1 and later, we have one set of values. */
+	if (sil_rev >= 2) {
+		switch (frequency) {
+		case MPUPLL_M_1000:
+			return TPS65910_OP_REG_SEL_1_3_2_5;
+		case MPUPLL_M_800:
+			return TPS65910_OP_REG_SEL_1_2_6;
+		case MPUPLL_M_720:
+			return TPS65910_OP_REG_SEL_1_2_0;
+		case MPUPLL_M_600:
+		case MPUPLL_M_300:
+			return TPS65910_OP_REG_SEL_1_1_3;
+		}
+	}
+
+	/* Default to PG1.0/PG2.0 values. */
+	return TPS65910_OP_REG_SEL_1_1_3;
+}
+#endif
arch/arm/include/asm/arch-am33xx/clocks_am33xx.h +9 -1
index 140379f..aad698d 100644
@@ -11,9 +11,17 @@
 #ifndef _CLOCKS_AM33XX_H_
 #define _CLOCKS_AM33XX_H_
 
+/* MAIN PLL Fdll supported frequencies */
+#define MPUPLL_M_1000	1000
+#define MPUPLL_M_800	800
+#define MPUPLL_M_720	720
+#define MPUPLL_M_600	600
+#define MPUPLL_M_550	550
+#define MPUPLL_M_300	300
+
 /* MAIN PLL Fdll = 550 MHz, by default */
 #ifndef CONFIG_SYS_MPUCLK
-#define CONFIG_SYS_MPUCLK	550
+#define CONFIG_SYS_MPUCLK	MPUPLL_M_550
 #endif
 
 #define UART_RESET		(0x1 << 1)
arch/arm/include/asm/arch-am33xx/sys_proto.h +3 -0
index 55f57ac..87b7d36 100644
@@ -10,6 +10,7 @@
 
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
+#include <asm/arch/cpu.h>
 
 #define BOARD_REV_ID	0x0
 
@@ -43,4 +44,6 @@ u32 wait_on_value(u32, u32, void *, u32);
 void enable_norboot_pin_mux(void);
 #endif
 void am33xx_spl_board_init(void);
+int am335x_get_efuse_mpu_max_freq(struct ctrl_dev *cdev);
+int am335x_get_tps65910_mpu_vdd(int sil_rev, int frequency);
 #endif
board/ti/am335x/board.c +134 -0

146 lines not on this page · raw message

include/configs/am335x_evm.h +5 -0
index e0a87f8..e55f0c6 100644
@@ -225,8 +225,13 @@
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	2
 #define CONFIG_SYS_I2C_MULTI_EEPROMS
 
+/* PMIC support */
+#define CONFIG_POWER_TPS65217
+#define CONFIG_POWER_TPS65910
+
 /* SPL */
 #ifndef CONFIG_NOR_BOOT
+#define CONFIG_SPL_POWER_SUPPORT
 #define CONFIG_SPL_YMODEM_SUPPORT
 #define CONFIG_SPL_NET_SUPPORT
 #define CONFIG_SPL_ENV_SUPPORT
Signature · 1 line
1.7.9.5