summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2019-10-16 18:10:31 -0400
committerTom Rini <[email protected]>2019-10-16 18:10:31 -0400
commitc83b1bb923421e95e499b22b010d2f9f463c1226 (patch)
tree48860f46e83dc30d9a77fac61c979fb3625588d7 /drivers
parentd2a93a88631929169d3ef1c537430330404f96f7 (diff)
parentd11ef4d54cab0e740efbceb9c6b5697a41770eea (diff)
Merge tag 'dm-pull-15oct19' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
binman enhancements: - Dropping some test Elf files and building them from source instead - Refactoring of x86 16-bit entries - Support for SPL symbols within sections - Handle the 'notes' sections and hidden symbols in recent binutils - Improved error reporting with a tool fails libfdt and documentation fixes vboot required-key test driver model power-domain controls patman Message-Id enhancement
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/device-remove.c5
-rw-r--r--drivers/core/device.c14
-rw-r--r--drivers/core/dump.c4
-rw-r--r--drivers/core/uclass.c4
-rw-r--r--drivers/pinctrl/Kconfig50
-rw-r--r--drivers/pinctrl/pinctrl-uclass.c20
-rw-r--r--drivers/power/domain/power-domain-uclass.c42
-rw-r--r--drivers/remoteproc/ti_k3_arm64_rproc.c1
-rw-r--r--drivers/spi/spi-uclass.c2
-rw-r--r--drivers/tpm/tpm2_tis_spi.c4
10 files changed, 131 insertions, 15 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 586fadee0a8..5c8dc4ad701 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -16,6 +16,7 @@
#include <dm/uclass.h>
#include <dm/uclass-internal.h>
#include <dm/util.h>
+#include <power-domain.h>
int device_chld_unbind(struct udevice *dev, struct driver *drv)
{
@@ -192,6 +193,10 @@ int device_remove(struct udevice *dev, uint flags)
}
}
+ if (!(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF) &&
+ (dev != gd->cur_serial_dev))
+ dev_power_domain_off(dev);
+
if (flags_remove(flags, drv->flags)) {
device_free(dev);
diff --git a/drivers/core/device.c b/drivers/core/device.c
index ce66c72e5ec..95f26efdd3b 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -82,6 +82,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
if (uc->uc_drv->name && ofnode_valid(node))
dev_read_alias_seq(dev, &dev->req_seq);
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+ if (dev->req_seq == -1)
+ dev->req_seq =
+ uclass_find_next_free_req_seq(drv->id);
+#endif
} else {
dev->req_seq = uclass_find_next_free_req_seq(drv->id);
}
@@ -307,7 +312,6 @@ static void *alloc_priv(int size, uint flags)
int device_probe(struct udevice *dev)
{
- struct power_domain pd;
const struct driver *drv;
int size = 0;
int ret;
@@ -389,9 +393,11 @@ int device_probe(struct udevice *dev)
pinctrl_select_state(dev, "default");
if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
- device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
- if (!power_domain_get(dev, &pd))
- power_domain_on(&pd);
+ (device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) &&
+ !(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF)) {
+ ret = dev_power_domain_on(dev);
+ if (ret)
+ goto fail;
}
ret = uclass_pre_probe_device(dev);
diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index 8fbfd93fb5e..4704049aee5 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -16,7 +16,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
struct udevice *child;
/* print the first 20 characters to not break the tree-format. */
- printf(" %-10.10s %2d [ %c ] %-20.20s ", dev->uclass->uc_drv->name,
+ printf(" %-10.10s %3d [ %c ] %-20.20s ", dev->uclass->uc_drv->name,
dev_get_uclass_index(dev, NULL),
dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
@@ -64,7 +64,7 @@ void dm_dump_all(void)
*/
static void dm_display_line(struct udevice *dev, int index)
{
- printf("%i %c %s @ %08lx", index,
+ printf("%-3i %c %s @ %08lx", index,
dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
dev->name, (ulong)map_to_sysmem(dev));
if (dev->seq != -1 || dev->req_seq != -1)
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index f217876cd2c..36f4d1c289d 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -269,7 +269,9 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
return -ENODEV;
}
-#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_CONTROL) || \
+ CONFIG_IS_ENABLED(OF_PLATDATA) || \
+ CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
int uclass_find_next_free_req_seq(enum uclass_id id)
{
struct uclass *uc;
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index a0ac167d145..6b41f66a86c 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -59,6 +59,38 @@ config PINCONF
This option enables pin configuration through the generic pinctrl
framework.
+config PINCONF_RECURSIVE
+ bool "Support recursive binding for pin configuration nodes"
+ depends on PINCTRL_FULL
+ default n if ARCH_STM32MP
+ default y
+ help
+ In the Linux pinctrl binding, the pin configuration nodes need not be
+ direct children of the pin controller device (may be grandchildren for
+ example). It is define is each individual pin controller device.
+ Say Y here if you want to keep this behavior with the pinconfig
+ u-class: all sub are recursivelly bounded.
+ If the option is disabled, this behavior is deactivated and only
+ the direct children of pin controller will be assumed as pin
+ configuration; you can save memory footprint when this feature is
+ no needed.
+
+config PINCONF_RECURSIVE
+ bool "Support recursive binding for pin configuration nodes"
+ depends on PINCTRL_FULL
+ default n if ARCH_STM32MP
+ default y
+ help
+ In the Linux pinctrl binding, the pin configuration nodes need not be
+ direct children of the pin controller device (may be grandchildren for
+ example). It is define is each individual pin controller device.
+ Say Y here if you want to keep this behavior with the pinconfig
+ u-class: all sub are recursivelly bounded.
+ If the option is disabled, this behavior is deactivated and only
+ the direct children of pin controller will be assumed as pin
+ configuration; you can save memory footprint when this feature is
+ no needed.
+
config SPL_PINCTRL
bool "Support pin controllers in SPL"
depends on SPL && SPL_DM
@@ -104,6 +136,24 @@ config SPL_PINCONF
This option is an SPL-variant of the PINCONF option.
See the help of PINCONF for details.
+config SPL_PINCONF_RECURSIVE
+ bool "Support recursive binding for pin configuration nodes in SPL"
+ depends on SPL_PINCTRL_FULL
+ default n if ARCH_STM32MP
+ default y
+ help
+ This option is an SPL-variant of the PINCONF_RECURSIVE option.
+ See the help of PINCONF_RECURSIVE for details.
+
+config SPL_PINCONF_RECURSIVE
+ bool "Support recursive binding for pin configuration nodes in SPL"
+ depends on SPL_PINCTRL_FULL
+ default n if ARCH_STM32MP
+ default y
+ help
+ This option is an SPL-variant of the PINCONF_RECURSIVE option.
+ See the help of PINCONF_RECURSIVE for details.
+
if PINCTRL || SPL_PINCTRL
config PINCTRL_AR933X
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 5b1cd29d862..0b1eb7fab4a 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
phandle = fdt32_to_cpu(*list++);
ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
&config);
- if (ret)
- return ret;
+ if (ret) {
+ dev_warn(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
+ __func__, ret);
+ continue;
+ }
ret = pinctrl_config_one(config);
- if (ret)
- return ret;
+ if (ret) {
+ dev_warn(dev, "%s: pinctrl_config_one: err=%d\n",
+ __func__, ret);
+ continue;
+ }
}
return 0;
@@ -151,7 +157,9 @@ static int pinconfig_post_bind(struct udevice *dev)
UCLASS_DRIVER(pinconfig) = {
.id = UCLASS_PINCONFIG,
+#if CONFIG_IS_ENABLED(PINCONFIG_RECURSIVE)
.post_bind = pinconfig_post_bind,
+#endif
.name = "pinconfig",
};
@@ -395,7 +403,7 @@ int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf,
* @dev: pinctrl device
* @return: 0 on success, or negative error code on failure
*/
-static int pinctrl_post_bind(struct udevice *dev)
+static int __maybe_unused pinctrl_post_bind(struct udevice *dev)
{
const struct pinctrl_ops *ops = pinctrl_get_ops(dev);
@@ -418,7 +426,9 @@ static int pinctrl_post_bind(struct udevice *dev)
UCLASS_DRIVER(pinctrl) = {
.id = UCLASS_PINCTRL,
+#if CONFIG_IS_ENABLED(PINCONF_RECURSIVE)
.post_bind = pinctrl_post_bind,
+#endif
.flags = DM_UC_FLAG_SEQ_ALIAS,
.name = "pinctrl",
};
diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c
index 2ea0ff24c7a..80df5aff501 100644
--- a/drivers/power/domain/power-domain-uclass.c
+++ b/drivers/power/domain/power-domain-uclass.c
@@ -7,6 +7,7 @@
#include <dm.h>
#include <power-domain.h>
#include <power-domain-uclass.h>
+#include <dm/device-internal.h>
static inline struct power_domain_ops *power_domain_dev_ops(struct udevice *dev)
{
@@ -107,6 +108,47 @@ int power_domain_off(struct power_domain *power_domain)
return ops->off(power_domain);
}
+#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA))
+static int dev_power_domain_ctrl(struct udevice *dev, bool on)
+{
+ struct power_domain pd;
+ int i, count, ret = 0;
+
+ count = dev_count_phandle_with_args(dev, "power-domains",
+ "#power-domain-cells");
+ for (i = 0; i < count; i++) {
+ ret = power_domain_get_by_index(dev, &pd, i);
+ if (ret)
+ return ret;
+ if (on)
+ ret = power_domain_on(&pd);
+ else
+ ret = power_domain_off(&pd);
+ }
+
+ /*
+ * power_domain_get() bound the device, thus
+ * we must remove it again to prevent unbinding
+ * active devices (which would result in unbind
+ * error).
+ */
+ if (count > 0 && !on)
+ device_remove(pd.dev, DM_REMOVE_NORMAL);
+
+ return ret;
+}
+
+int dev_power_domain_on(struct udevice *dev)
+{
+ return dev_power_domain_ctrl(dev, true);
+}
+
+int dev_power_domain_off(struct udevice *dev)
+{
+ return dev_power_domain_ctrl(dev, false);
+}
+#endif
+
UCLASS_DRIVER(power_domain) = {
.id = UCLASS_POWER_DOMAIN,
.name = "power_domain",
diff --git a/drivers/remoteproc/ti_k3_arm64_rproc.c b/drivers/remoteproc/ti_k3_arm64_rproc.c
index 9676a96f988..3e35293514e 100644
--- a/drivers/remoteproc/ti_k3_arm64_rproc.c
+++ b/drivers/remoteproc/ti_k3_arm64_rproc.c
@@ -225,4 +225,5 @@ U_BOOT_DRIVER(k3_arm64) = {
.ops = &k3_arm64_ops,
.probe = k3_arm64_probe,
.priv_auto_alloc_size = sizeof(struct k3_arm64_privdata),
+ .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF,
};
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 76c4b53c165..a4d1b65682d 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -299,7 +299,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
bool created = false;
int ret;
-#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
ret = uclass_first_device_err(UCLASS_SPI, &bus);
#else
ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c
index 7186c179d11..3d105fddba1 100644
--- a/drivers/tpm/tpm2_tis_spi.c
+++ b/drivers/tpm/tpm2_tis_spi.c
@@ -596,9 +596,9 @@ static int tpm_tis_spi_probe(struct udevice *dev)
log(LOGC_NONE, LOGL_NOTICE, "%s: missing reset GPIO\n",
__func__);
} else {
- dm_gpio_set_value(&reset_gpio, 0);
- mdelay(1);
dm_gpio_set_value(&reset_gpio, 1);
+ mdelay(1);
+ dm_gpio_set_value(&reset_gpio, 0);
}
}