Merge branch '2022-04-06-assorted-updates'

- Add DM_PMIC support to TPS65217 and migrate some platforms to it.
- mkimage verification fixes
- DM rST fix, add missing flag when linking u-boot-elf.o
This commit is contained in:
Tom Rini 2022-04-06 11:51:00 -04:00
commit 88b6b33253
32 changed files with 174 additions and 20 deletions

View file

@ -1708,6 +1708,7 @@ u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE
quiet_cmd_u-boot-elf ?= LD $@
cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \
$(if $(CONFIG_SYS_BIG_ENDIAN),-EB,-EL) \
-T u-boot-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \
-Ttext=$(CONFIG_SYS_TEXT_BASE)
u-boot.elf: u-boot.bin u-boot-elf.lds

View file

@ -65,6 +65,9 @@ CONFIG_DM_ETH=y
CONFIG_PHY_GIGE=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -88,6 +88,9 @@ CONFIG_DM_ETH=y
CONFIG_PHY_GIGE=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -79,6 +79,9 @@ CONFIG_PHY_SMSC=y
CONFIG_DM_ETH=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -110,6 +110,7 @@ CONFIG_PHY=y
CONFIG_NOP_PHY=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -72,6 +72,9 @@ CONFIG_PHY_SMSC=y
CONFIG_DM_ETH=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -74,6 +74,9 @@ CONFIG_PHY_SMSC=y
CONFIG_DM_ETH=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -70,4 +70,5 @@ CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_PMIC_TPS65217=y
CONFIG_LZO=y

View file

@ -68,4 +68,5 @@ CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_PMIC_TPS65217=y
CONFIG_LZO=y

View file

@ -71,4 +71,5 @@ CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_PMIC_TPS65217=y
CONFIG_LZO=y

View file

@ -70,4 +70,5 @@ CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_PMIC_TPS65217=y
CONFIG_LZO=y

View file

@ -68,6 +68,7 @@ CONFIG_MMC_OMAP_HS=y
CONFIG_PHY_SMSC=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -91,6 +91,9 @@ CONFIG_MMC_OMAP_HS=y
CONFIG_PHY_NATSEMI=y
CONFIG_DM_ETH=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_DM_SERIAL=y
CONFIG_USB=y
CONFIG_USB_MUSB_HOST=y

View file

@ -100,6 +100,9 @@ CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
CONFIG_PHY_NATSEMI=y
CONFIG_DM_ETH=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_DM_SERIAL=y
CONFIG_USB=y
CONFIG_USB_MUSB_HOST=y

View file

@ -104,6 +104,9 @@ CONFIG_SPI_FLASH_WINBOND=y
CONFIG_PHY_NATSEMI=y
CONFIG_DM_ETH=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_TPS65217=y
CONFIG_DM_SERIAL=y
CONFIG_SPI=y
CONFIG_DM_SPI=y

View file

@ -104,6 +104,7 @@ CONFIG_SPI_FLASH_WINBOND=y
CONFIG_PHY_NATSEMI=y
CONFIG_DM_ETH=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PMIC_TPS65217=y
CONFIG_DM_SERIAL=y
CONFIG_SPI=y
CONFIG_DM_SPI=y

View file

@ -87,6 +87,7 @@ CONFIG_MISC=y
CONFIG_MMC_OMAP_HS=y
CONFIG_DM_ETH=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PMIC_TPS65217=y
CONFIG_DM_SERIAL=y
CONFIG_USB=y
CONFIG_USB_MUSB_HOST=y

View file

@ -66,6 +66,7 @@ CONFIG_PHY_SMSC=y
CONFIG_DM_ETH=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
CONFIG_PMIC_TPS65217=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y

View file

@ -369,6 +369,14 @@ config PMIC_TPS65941
endif
config PMIC_TPS65217
bool "Enable driver for Texas Instruments TPS65217 PMIC"
---help---
The TPS65217 is a PMIC containing several LDOs, DC to DC convertors,
FETs and a battery charger. This driver provides register access
only, and you can enable the regulator/charger drivers separately if
required.
config POWER_MC34VR500
bool "Enable driver for Freescale MC34VR500 PMIC"
depends on !DM_PMIC

View file

@ -36,7 +36,7 @@ obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
obj-$(CONFIG_POWER_PCA9450) += pmic_pca9450.o
obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
obj-$(CONFIG_POWER_PFUZE3000) += pmic_pfuze3000.o
obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
obj-$(CONFIG_PMIC_TPS65217) += pmic_tps65217.o
obj-$(CONFIG_POWER_TPS65218) += pmic_tps62362.o
obj-$(CONFIG_POWER_TPS65218) += pmic_tps65218.o
obj-$(CONFIG_POWER_TPS65910) += pmic_tps65910.o

View file

@ -6,8 +6,13 @@
#include <common.h>
#include <i2c.h>
#include <dm.h>
#include <errno.h>
#include <fdtdec.h>
#include <power/pmic.h>
#include <power/tps65217.h>
#if !CONFIG_IS_ENABLED(DM_PMIC)
struct udevice *tps65217_dev __section(".data") = NULL;
/**
@ -148,3 +153,80 @@ int power_tps65217_init(unsigned char bus)
#endif
return 0;
}
#else /* CONFIG_IS_ENABLED(DM_PMIC) */
static const struct pmic_child_info pmic_children_info[] = {
{ .prefix = "ldo", .driver = "tps65217_ldo" },
{ },
};
static int tps65217_reg_count(struct udevice *dev)
{
return TPS65217_PMIC_NUM_OF_REGS;
}
static int tps65217_write(struct udevice *dev, uint reg, const uint8_t *buff,
int len)
{
if (dm_i2c_write(dev, reg, buff, len)) {
pr_err("write error to device: %p register: %#x!\n", dev, reg);
return -EIO;
}
return 0;
}
static int tps65217_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
{
int ret;
ret = dm_i2c_read(dev, reg, buff, len);
if (ret) {
pr_err("read error %d from device: %p register: %#x!\n", ret,
dev, reg);
return -EIO;
}
return 0;
}
static int tps65217_bind(struct udevice *dev)
{
ofnode regulators_node;
int children;
regulators_node = dev_read_subnode(dev, "regulators");
if (!ofnode_valid(regulators_node)) {
debug("%s: %s regulators subnode not found!\n", __func__,
dev->name);
return -ENXIO;
}
debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
children = pmic_bind_children(dev, regulators_node, pmic_children_info);
if (!children)
debug("%s: %s - no child found\n", __func__, dev->name);
/* Always return success for this device */
return 0;
}
static struct dm_pmic_ops tps65217_ops = {
.reg_count = tps65217_reg_count,
.read = tps65217_read,
.write = tps65217_write,
};
static const struct udevice_id tps65217_ids[] = {
{ .compatible = "ti,tps65217" },
{ }
};
U_BOOT_DRIVER(pmic_tps65217) = {
.name = "tps65217 pmic",
.id = UCLASS_PMIC,
.of_match = tps65217_ids,
.bind = tps65217_bind,
.ops = &tps65217_ops,
};
#endif

View file

@ -166,7 +166,6 @@
#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
/* PMIC support */
#define CONFIG_POWER_TPS65217
#define CONFIG_POWER_TPS65910
/* SPL */

View file

@ -94,9 +94,6 @@
#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
/* PMIC support */
#define CONFIG_POWER_TPS65217
/* Bootcount using the RTC block */
#define CONFIG_SYS_BOOTCOUNT_LE

View file

@ -145,7 +145,4 @@
#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
/* PMIC support */
#define CONFIG_POWER_TPS65217
#endif /* ! __CONFIG_AM335X_SHC_H */

View file

@ -50,7 +50,6 @@
#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
/* PMIC support */
#define CONFIG_POWER_TPS65217
#define CONFIG_POWER_TPS65910
/* SPL */

View file

@ -22,8 +22,6 @@
#define V_OSCK 26000000 /* Clock output from T2 */
#define V_SCLK (V_OSCK)
#define CONFIG_POWER_TPS65217
/*
* When we have NAND flash we expect to be making use of mtdparts,
* both for ease of use in U-Boot and for passing information on to

View file

@ -26,7 +26,6 @@
/* Timer information */
#define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */
#define CONFIG_SYS_TIMERBASE 0x48040000 /* Use Timer2 */
#define CONFIG_POWER_TPS65217
#include <asm/arch/omap.h>

View file

@ -106,9 +106,6 @@
#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
/* PMIC support */
#define CONFIG_POWER_TPS65217
/* SPL */
/* Bootcount using the RTC block */
#define CONFIG_SYS_BOOTCOUNT_BE

View file

@ -900,10 +900,10 @@ int ofnode_read_pci_vendev(ofnode node, u16 *vendor, u16 *device);
* Look at the compatible property of a device node that represents a eth phy
* device and extract phy vendor id and device id from it.
*
* @param node node to examine
* @param vendor vendor id of the eth phy device
* @param device device id of the eth phy device
* @return 0 if ok, negative on error
* @node: node to examine
* @vendor: vendor id of the eth phy device
* @device: device id of the eth phy device
* Return: 0 if ok, negative on error
*/
int ofnode_read_eth_phy_id(ofnode node, u16 *vendor, u16 *device);

View file

@ -549,7 +549,6 @@ CONFIG_POWER_PFUZE3000_I2C_ADDR
CONFIG_POWER_SPI
CONFIG_POWER_TPS62362
CONFIG_POWER_TPS65090_EC
CONFIG_POWER_TPS65217
CONFIG_POWER_TPS65218
CONFIG_POWER_TPS65910
CONFIG_PPC_CLUSTER_START

View file

@ -341,6 +341,44 @@ static void process_args(int argc, char **argv)
usage("Missing output filename");
}
static void verify_image(const struct image_type_params *tparams)
{
struct stat sbuf;
void *ptr;
int ifd;
ifd = open(params.imagefile, O_RDONLY | O_BINARY);
if (ifd < 0) {
fprintf(stderr, "%s: Can't open %s: %s\n",
params.cmdname, params.imagefile,
strerror(errno));
exit(EXIT_FAILURE);
}
if (fstat(ifd, &sbuf) < 0) {
fprintf(stderr, "%s: Can't stat %s: %s\n",
params.cmdname, params.imagefile, strerror(errno));
exit(EXIT_FAILURE);
}
params.file_size = sbuf.st_size;
ptr = mmap(0, params.file_size, PROT_READ, MAP_SHARED, ifd, 0);
if (ptr == MAP_FAILED) {
fprintf(stderr, "%s: Can't map %s: %s\n",
params.cmdname, params.imagefile, strerror(errno));
exit(EXIT_FAILURE);
}
if (tparams->verify_header((unsigned char *)ptr, params.file_size, &params) != 0) {
fprintf(stderr, "%s: Failed to verify header of %s\n",
params.cmdname, params.imagefile);
exit(EXIT_FAILURE);
}
(void)munmap(ptr, params.file_size);
(void)close(ifd);
}
int main(int argc, char **argv)
{
int ifd = -1;
@ -703,6 +741,9 @@ int main(int argc, char **argv)
exit (EXIT_FAILURE);
}
if (tparams->verify_header)
verify_image(tparams);
exit (EXIT_SUCCESS);
}

View file

@ -450,6 +450,10 @@ int rkcommon_verify_header(unsigned char *buf, int size,
struct spl_info *img_spl_info, *spl_info;
int ret;
/* spl_hdr is abandon on header_v2 */
if ((*(uint32_t *)buf) == RK_MAGIC_V2)
return 0;
ret = rkcommon_parse_header(buf, &header0, &img_spl_info);
/* If this is the (unimplemented) RC4 case, then rewrite the result */