From fc69d472621b5c7513bcb8b4e1fe58ca8f5e035a Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 2 Jun 2017 15:00:31 +0530 Subject: board: ti: AM43XX: Add ddr voltage rail configuration Add ddr voltage rail (dcdc3) configuration. Set the dcdc3 DDR supply to 1.35V. Signed-off-by: Keerthy Reviewed-by: Tom Rini Reviewed-by: Lokesh Vutla --- include/power/tps65218.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/power/tps65218.h b/include/power/tps65218.h index e3538e21f04..43b9c9aa52d 100644 --- a/include/power/tps65218.h +++ b/include/power/tps65218.h @@ -63,6 +63,7 @@ enum { #define TPS65218_DCDC_VOLT_SEL_1200MV 0x23 #define TPS65218_DCDC_VOLT_SEL_1260MV 0x29 #define TPS65218_DCDC_VOLT_SEL_1330MV 0x30 +#define TPS65218_DCDC3_VOLT_SEL_1350MV 0x12 #define TPS65218_CC_STAT (BIT(0) | BIT(1)) #define TPS65218_STATE (BIT(2) | BIT(3)) -- cgit v1.3.1 From 9f103b9cb5f8de4f196b5ef8f6ddb4749cd732ba Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 27 May 2017 11:37:17 -0600 Subject: dm: blk: Add a way to obtain a block device from its parent Many devices support a child block device (e.g. MMC, USB). Add a convenient way to get this device given the parent device. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- drivers/block/blk-uclass.c | 26 ++++++++++++++++++++++++++ include/blk.h | 7 +++++++ test/dm/blk.c | 18 ++++++++++++++++++ 3 files changed, 51 insertions(+) (limited to 'include') diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 61456752718..23f131b7ad7 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -453,6 +453,32 @@ int blk_prepare_device(struct udevice *dev) return 0; } +int blk_get_from_parent(struct udevice *parent, struct udevice **devp) +{ + struct udevice *dev; + enum uclass_id id; + int ret; + + device_find_first_child(parent, &dev); + if (!dev) { + debug("%s: No block device found for parent '%s'\n", __func__, + parent->name); + return -ENODEV; + } + id = device_get_uclass_id(dev); + if (id != UCLASS_BLK) { + debug("%s: Incorrect uclass %s for block device '%s'\n", + __func__, uclass_get_name(id), dev->name); + return -ENOTBLK; + } + ret = device_probe(dev); + if (ret) + return ret; + *devp = dev; + + return 0; +} + int blk_find_max_devnum(enum if_type if_type) { struct udevice *dev; diff --git a/include/blk.h b/include/blk.h index a128ee48414..4d60987f61b 100644 --- a/include/blk.h +++ b/include/blk.h @@ -616,4 +616,11 @@ ulong blk_write_devnum(enum if_type if_type, int devnum, lbaint_t start, */ int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart); +/** + * blk_get_from_parent() - obtain a block device by looking up its parent + * + * All devices with + */ +int blk_get_from_parent(struct udevice *parent, struct udevice **devp); + #endif diff --git a/test/dm/blk.c b/test/dm/blk.c index 5c5eb829a02..923e8d95f06 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -150,3 +150,21 @@ static int dm_test_blk_devnum(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_blk_devnum, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test that we can get a block from its parent */ +static int dm_test_blk_get_from_parent(struct unit_test_state *uts) +{ + struct udevice *dev, *blk; + + ut_assertok(uclass_get_device(UCLASS_MMC, 0, &dev)); + ut_assertok(blk_get_from_parent(dev, &blk)); + + ut_assertok(uclass_get_device(UCLASS_I2C, 0, &dev)); + ut_asserteq(-ENOTBLK, blk_get_from_parent(dev, &blk)); + + ut_assertok(uclass_get_device(UCLASS_GPIO, 0, &dev)); + ut_asserteq(-ENODEV, blk_get_from_parent(dev, &blk)); + + return 0; +} +DM_TEST(dm_test_blk_get_from_parent, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- cgit v1.3.1 From cdad57a7c1ab7c226f3997245229445b628a5f2a Mon Sep 17 00:00:00 2001 From: Keerthy Date: Wed, 7 Jun 2017 19:08:28 +0530 Subject: power: pmic: lp87565: Add the basic pmic support Add support to bind the regulators/child nodes with the pmic. Signed-off-by: Keerthy Signed-off-by: Jaehoon Chung --- drivers/power/pmic/Kconfig | 7 ++++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/lp87565.c | 87 ++++++++++++++++++++++++++++++++++++++++++++ include/power/lp87565.h | 12 ++++++ 4 files changed, 107 insertions(+) create mode 100644 drivers/power/pmic/lp87565.c create mode 100644 include/power/lp87565.h (limited to 'include') diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig index 3f50c121571..e3f9e4dfc0d 100644 --- a/drivers/power/pmic/Kconfig +++ b/drivers/power/pmic/Kconfig @@ -188,6 +188,13 @@ config PMIC_LP873X The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children. +config PMIC_LP87565 + bool "Enable driver for Texas Instruments LP87565 PMIC" + depends on DM_PMIC + ---help--- + The LP87565 is a PMIC containing a bunch of SMPS. + This driver binds the pmic children. + config POWER_MC34VR500 bool "Enable driver for Freescale MC34VR500 PMIC" ---help--- diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile index f409e3a0b36..f488799a923 100644 --- a/drivers/power/pmic/Makefile +++ b/drivers/power/pmic/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_PMIC_TPS65090) += tps65090.o obj-$(CONFIG_PMIC_S5M8767) += s5m8767.o obj-$(CONFIG_$(SPL_)PMIC_PALMAS) += palmas.o obj-$(CONFIG_$(SPL_)PMIC_LP873X) += lp873x.o +obj-$(CONFIG_$(SPL_)PMIC_LP87565) += lp87565.o obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o obj-$(CONFIG_POWER_MAX77696) += pmic_max77696.o diff --git a/drivers/power/pmic/lp87565.c b/drivers/power/pmic/lp87565.c new file mode 100644 index 00000000000..782a46c4cc3 --- /dev/null +++ b/drivers/power/pmic/lp87565.c @@ -0,0 +1,87 @@ +/* + * (C) Copyright 2017 Texas Instruments Incorporated, + * Keerthy + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static const struct pmic_child_info pmic_children_info[] = { + { .prefix = "buck", .driver = LP87565_BUCK_DRIVER }, + { }, +}; + +static int lp87565_write(struct udevice *dev, uint reg, const uint8_t *buff, + int len) +{ + int ret; + + ret = dm_i2c_write(dev, reg, buff, len); + if (ret) + error("write error to device: %p register: %#x!", dev, reg); + + return ret; +} + +static int lp87565_read(struct udevice *dev, uint reg, uint8_t *buff, int len) +{ + int ret; + + ret = dm_i2c_read(dev, reg, buff, len); + if (ret) + error("read error from device: %p register: %#x!", dev, reg); + + return ret; +} + +static int lp87565_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!", __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) + printf("%s: %s - no child found\n", __func__, dev->name); + + /* Always return success for this device */ + return 0; +} + +static struct dm_pmic_ops lp87565_ops = { + .read = lp87565_read, + .write = lp87565_write, +}; + +static const struct udevice_id lp87565_ids[] = { + { .compatible = "ti,lp87565", .data = LP87565 }, + { .compatible = "ti,lp87565-q1", .data = LP87565_Q1 }, + { } +}; + +U_BOOT_DRIVER(pmic_lp87565) = { + .name = "lp87565_pmic", + .id = UCLASS_PMIC, + .of_match = lp87565_ids, + .bind = lp87565_bind, + .ops = &lp87565_ops, +}; diff --git a/include/power/lp87565.h b/include/power/lp87565.h new file mode 100644 index 00000000000..5160f5df6ce --- /dev/null +++ b/include/power/lp87565.h @@ -0,0 +1,12 @@ +#define LP87565 0x0 +#define LP87565_Q1 0x1 + +#define LP87565_BUCK_NUM 6 + +/* Drivers name */ +#define LP87565_BUCK_DRIVER "lp87565_buck" + +#define LP87565_BUCK_VOLT_MASK 0xFF +#define LP87565_BUCK_VOLT_MAX_HEX 0xFF +#define LP87565_BUCK_VOLT_MAX 3360000 +#define LP87565_BUCK_MODE_MASK 0x80 -- cgit v1.3.1 From abf54bf978ed9932d69ee7f937012398d0d8d08f Mon Sep 17 00:00:00 2001 From: Brock Zheng Techyauld Ltd Date: Tue, 6 Jun 2017 09:06:21 +0800 Subject: Fixup bug in PMIC TPS65217 register address definition The addresses of the registers in TI TPS65217 are not continuous. There is a gap between ENABLE(0x16) and DEFUVLO(0x18). No 0x17 register available. Fixup the enum values by adding a 'reserved' placeholder to correct the addresses higher than 0x17. Series-to: Heiko Schocher Signed-off-by: Brock Zheng Techyauld Ltd Reviewed-by: Lukasz Majewski --- include/power/tps65217.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/power/tps65217.h b/include/power/tps65217.h index 69a49f76fef..cb07ea5ce62 100644 --- a/include/power/tps65217.h +++ b/include/power/tps65217.h @@ -38,6 +38,7 @@ enum { TPS65217_DEFLS1, TPS65217_DEFLS2, TPS65217_ENABLE, + TPS65217_RESERVED0, /* no 0x17 register available */ TPS65217_DEFUVLO, TPS65217_SEQ1, TPS65217_SEQ2, -- cgit v1.3.1