All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 00/10] Various fixes and improvements
@ 2018-11-18 15:14 Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations Simon Glass
                   ` (17 more replies)
  0 siblings, 18 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

This series collects together a large number of small patches that I have
been fiddling with for a while. At lot of them relate to SPL and TPL and
updating Chromium OS verified boot to work on U-Boot.

Unfortunately one patch (RTC) in the original series had a subtle failure
which requires a bit of fiddling to fix. This v2 series includes this.

Changes in v2:
- Rebase to master
- Correct definition of log() when logging is disabled
- Leave the misc uclass alone since it stops sandbox_spl working
- Drop patches previously applied
- Add new patches to support the RTC change

Simon Glass (10):
  malloc_simple: Add logging of allocations
  spl: misc: Allow misc drivers in SPL and TPL
  power: pmic: Correct debug/error output
  test: Add a 'make qcheck' target for quicker testing
  dm: core: Export uclass_find_device_by_phandle()
  dm: core: Add a few more specific child-finding functions
  dm: core: Put UCLASS_SIMPLE_BUS in order
  dm: sandbox: i2c: Add a new 'emulation parent' uclass
  dm: sandbox: i2c: Use new emulator parent uclass
  rtc: Allow child drivers

 Makefile                             |  6 ++-
 arch/sandbox/dts/sandbox.dts         | 25 ++++++---
 arch/sandbox/dts/sandbox_pmic.dtsi   | 71 ++++++++++++-------------
 arch/sandbox/dts/test.dts            | 30 +++++++----
 common/malloc_simple.c               | 58 +++++++++++++--------
 drivers/core/device.c                | 34 ++++++++++++
 drivers/core/uclass.c                |  6 +--
 drivers/i2c/i2c-emul-uclass.c        | 77 ++++++++++++++++++++++++++++
 drivers/i2c/sandbox_i2c.c            | 20 +-------
 drivers/misc/Kconfig                 | 72 ++++++++++++++++++++++++++
 drivers/misc/Makefile                |  8 +--
 drivers/power/pmic/act8846.c         |  2 +-
 drivers/power/pmic/as3722.c          | 14 ++---
 drivers/power/pmic/as3722_gpio.c     | 11 ++--
 drivers/power/pmic/i2c_pmic_emul.c   |  2 +-
 drivers/power/pmic/lp873x.c          |  6 +--
 drivers/power/pmic/lp87565.c         |  6 +--
 drivers/power/pmic/max77686.c        |  8 +--
 drivers/power/pmic/max8997.c         |  4 +-
 drivers/power/pmic/max8998.c         |  4 +-
 drivers/power/pmic/mc34708.c         |  4 +-
 drivers/power/pmic/palmas.c          |  8 +--
 drivers/power/pmic/pfuze100.c        |  6 +--
 drivers/power/pmic/rk8xx.c           |  6 +--
 drivers/power/pmic/rn5t567.c         |  4 +-
 drivers/power/pmic/s2mps11.c         |  8 +--
 drivers/power/pmic/s5m8767.c         |  6 +--
 drivers/power/pmic/sandbox.c         |  4 +-
 drivers/power/pmic/stpmu1.c          |  2 +-
 drivers/power/pmic/tps65090.c        |  8 +--
 drivers/rtc/rtc-uclass.c             |  1 +
 include/dm/device.h                  | 25 +++++++++
 include/dm/uclass-id.h               |  3 +-
 include/dm/uclass-internal.h         | 17 ++++++
 include/i2c.h                        | 21 ++++++++
 include/log.h                        |  2 +-
 include/malloc.h                     |  1 +
 test/README                          |  6 ++-
 test/dm/i2c.c                        |  2 +-
 test/dm/rtc.c                        |  9 ++--
 test/dm/test-fdt.c                   | 47 +++++++++++++++++
 test/py/tests/test_fs/test_basic.py  |  1 +
 test/py/tests/test_fs/test_ext.py    |  1 +
 test/py/tests/test_fs/test_mkdir.py  |  1 +
 test/py/tests/test_fs/test_unlink.py |  1 +
 test/run                             | 10 +++-
 46 files changed, 502 insertions(+), 166 deletions(-)

-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL Simon Glass
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

It is sometimes useful to see what memory is being allocated early during
boot. Add logging to support this, using a new LOGC_ALLOC category.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Rebase to master
- Correct definition of log() when logging is disabled

 common/malloc_simple.c | 58 +++++++++++++++++++++++++++---------------
 include/log.h          |  2 +-
 include/malloc.h       |  1 +
 3 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index 871b5444bd7..eabbb70128b 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -5,6 +5,8 @@
  * Copyright (c) 2014 Google, Inc
  */
 
+#define LOG_CATEGORY LOGC_ALLOC
+
 #include <common.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -12,40 +14,47 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void *malloc_simple(size_t bytes)
+static void *alloc_simple(size_t bytes, int align)
 {
-	ulong new_ptr;
+	ulong addr, new_ptr;
 	void *ptr;
 
-	new_ptr = gd->malloc_ptr + bytes;
-	debug("%s: size=%zx, ptr=%lx, limit=%lx: ", __func__, bytes, new_ptr,
-	      gd->malloc_limit);
+	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
+	new_ptr = addr + bytes - gd->malloc_base;
+	log_debug("size=%zx, ptr=%lx, limit=%lx: ", bytes, new_ptr,
+		  gd->malloc_limit);
 	if (new_ptr > gd->malloc_limit) {
-		debug("space exhausted\n");
+		log_err("alloc space exhausted\n");
 		return NULL;
 	}
-	ptr = map_sysmem(gd->malloc_base + gd->malloc_ptr, bytes);
+
+	ptr = map_sysmem(addr, bytes);
 	gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
-	debug("%lx\n", (ulong)ptr);
 
 	return ptr;
 }
 
-void *memalign_simple(size_t align, size_t bytes)
+void *malloc_simple(size_t bytes)
 {
-	ulong addr, new_ptr;
 	void *ptr;
 
-	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
-	new_ptr = addr + bytes - gd->malloc_base;
-	if (new_ptr > gd->malloc_limit) {
-		debug("space exhausted\n");
-		return NULL;
-	}
+	ptr = alloc_simple(bytes, 1);
+	if (!ptr)
+		return ptr;
 
-	ptr = map_sysmem(addr, bytes);
-	gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
-	debug("%lx\n", (ulong)ptr);
+	log_debug("%lx\n", (ulong)ptr);
+
+	return ptr;
+}
+
+void *memalign_simple(size_t align, size_t bytes)
+{
+	void *ptr;
+
+	ptr = alloc_simple(bytes, align);
+	if (!ptr)
+		return ptr;
+	log_debug("aligned to %lx\n", (ulong)ptr);
 
 	return ptr;
 }
@@ -57,9 +66,16 @@ void *calloc(size_t nmemb, size_t elem_size)
 	void *ptr;
 
 	ptr = malloc(size);
-	if (ptr)
-		memset(ptr, '\0', size);
+	if (!ptr)
+		return ptr;
+	memset(ptr, '\0', size);
 
 	return ptr;
 }
 #endif
+
+void malloc_simple_info(void)
+{
+	log_info("malloc_simple: %lx bytes used, %lx remain\n", gd->malloc_ptr,
+		 CONFIG_VAL(SYS_MALLOC_F_LEN) - gd->malloc_ptr);
+}
diff --git a/include/log.h b/include/log.h
index a872fc6ef5f..5fa80d53856 100644
--- a/include/log.h
+++ b/include/log.h
@@ -110,7 +110,7 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
 /* Emit a log record if the level is less that the maximum */
 #define log(_cat, _level, _fmt, _args...) ({ \
 	int _l = _level; \
-	if (_l <= _LOG_MAX_LEVEL) \
+	if (CONFIG_IS_ENABLED(LOG) && _l <= _LOG_MAX_LEVEL) \
 		_log((enum log_category_t)(_cat), _l, __FILE__, __LINE__, \
 		      __func__, \
 		      pr_fmt(_fmt), ##_args); \
diff --git a/include/malloc.h b/include/malloc.h
index 8175c75920c..b714fedf457 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -880,6 +880,7 @@ static inline void free(void *ptr) {}
 void *calloc(size_t nmemb, size_t size);
 void *memalign_simple(size_t alignment, size_t bytes);
 void *realloc_simple(void *ptr, size_t size);
+void malloc_simple_info(void);
 #else
 
 # ifdef USE_DL_PREFIX
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-20 13:49   ` Jean-Jacques Hiblot
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output Simon Glass
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

In some cases it is necessary to read the keyboard in early phases of
U-Boot. The cros_ec keyboard is kept in the misc directory. Update the
config to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Leave the misc uclass alone since it stops sandbox_spl working

 drivers/misc/Kconfig  | 72 +++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/Makefile |  8 +++--
 2 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 48febc47d26..802046cf966 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -13,6 +13,24 @@ config MISC
 	  set of generic read, write and ioctl methods may be used to
 	  access the device.
 
+config SPL_MISC
+	bool "Enable Driver Model for Misc drivers in SPL"
+	depends on SPL_DM
+	help
+	  Enable driver model for miscellaneous devices. This class is
+	  used only for those do not fit other more general classes. A
+	  set of generic read, write and ioctl methods may be used to
+	  access the device.
+
+config TPL_MISC
+	bool "Enable Driver Model for Misc drivers in TPL"
+	depends on TPL_DM
+	help
+	  Enable driver model for miscellaneous devices. This class is
+	  used only for those do not fit other more general classes. A
+	  set of generic read, write and ioctl methods may be used to
+	  access the device.
+
 config ALTERA_SYSID
 	bool "Altera Sysid support"
 	depends on MISC
@@ -68,6 +86,24 @@ config CROS_EC
 	  control access to the battery and main PMIC depending on the
 	  device. You can use the 'crosec' command to access it.
 
+config SPL_CROS_EC
+	bool "Enable Chrome OS EC in SPL"
+	help
+	  Enable access to the Chrome OS EC in SPL. This is a separate
+	  microcontroller typically available on a SPI bus on Chromebooks. It
+	  provides access to the keyboard, some internal storage and may
+	  control access to the battery and main PMIC depending on the
+	  device. You can use the 'crosec' command to access it.
+
+config TPL_CROS_EC
+	bool "Enable Chrome OS EC in TPL"
+	help
+	  Enable access to the Chrome OS EC in TPL. This is a separate
+	  microcontroller typically available on a SPI bus on Chromebooks. It
+	  provides access to the keyboard, some internal storage and may
+	  control access to the battery and main PMIC depending on the
+	  device. You can use the 'crosec' command to access it.
+
 config CROS_EC_I2C
 	bool "Enable Chrome OS EC I2C driver"
 	depends on CROS_EC
@@ -86,6 +122,24 @@ config CROS_EC_LPC
 	  through a legacy port interface, so on x86 machines the main
 	  function of the EC is power and thermal management.
 
+config SPL_CROS_EC_LPC
+	bool "Enable Chrome OS EC LPC driver in SPL"
+	depends on CROS_EC
+	help
+	  Enable I2C access to the Chrome OS EC. This is used on x86
+	  Chromebooks such as link and falco. The keyboard is provided
+	  through a legacy port interface, so on x86 machines the main
+	  function of the EC is power and thermal management.
+
+config TPL_CROS_EC_LPC
+	bool "Enable Chrome OS EC LPC driver in TPL"
+	depends on CROS_EC
+	help
+	  Enable I2C access to the Chrome OS EC. This is used on x86
+	  Chromebooks such as link and falco. The keyboard is provided
+	  through a legacy port interface, so on x86 machines the main
+	  function of the EC is power and thermal management.
+
 config CROS_EC_SANDBOX
 	bool "Enable Chrome OS EC sandbox driver"
 	depends on CROS_EC && SANDBOX
@@ -95,6 +149,24 @@ config CROS_EC_SANDBOX
 	  EC flash read/write/erase support and a few other things. It is
 	  enough to perform a Chrome OS verified boot on sandbox.
 
+config SPL_CROS_EC_SANDBOX
+	bool "Enable Chrome OS EC sandbox driver in SPL"
+	depends on SPL_CROS_EC && SANDBOX
+	help
+	  Enable a sandbox emulation of the Chrome OS EC in SPL. This supports
+	  keyboard (use the -l flag to enable the LCD), verified boot context,
+	  EC flash read/write/erase support and a few other things. It is
+	  enough to perform a Chrome OS verified boot on sandbox.
+
+config TPL_CROS_EC_SANDBOX
+	bool "Enable Chrome OS EC sandbox driver in TPL"
+	depends on TPL_CROS_EC && SANDBOX
+	help
+	  Enable a sandbox emulation of the Chrome OS EC in TPL. This supports
+	  keyboard (use the -l flag to enable the LCD), verified boot context,
+	  EC flash read/write/erase support and a few other things. It is
+	  enough to perform a Chrome OS verified boot on sandbox.
+
 config CROS_EC_SPI
 	bool "Enable Chrome OS EC SPI driver"
 	depends on CROS_EC
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 302d4415927..6efb8134b14 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -4,11 +4,13 @@
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
 obj-$(CONFIG_MISC) += misc-uclass.o
+
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC) += cros_ec.o
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC_SANDBOX) += cros_ec_sandbox.o
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC_LPC) += cros_ec_lpc.o
+
 ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_CROS_EC) += cros_ec.o
-obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o
 obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o
-obj-$(CONFIG_CROS_EC_SANDBOX) += cros_ec_sandbox.o
 obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o
 endif
 
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 21:17   ` Lukasz Majewski
  2018-11-29 17:39   ` sjg at google.com
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing Simon Glass
                   ` (14 subsequent siblings)
  17 siblings, 2 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

There is a newline missing from quite a few printf() strings in these pmic
files. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/power/pmic/act8846.c     |  2 +-
 drivers/power/pmic/as3722.c      | 14 +++++++-------
 drivers/power/pmic/as3722_gpio.c | 11 ++++++-----
 drivers/power/pmic/lp873x.c      |  6 +++---
 drivers/power/pmic/lp87565.c     |  6 +++---
 drivers/power/pmic/max77686.c    |  8 ++++----
 drivers/power/pmic/max8997.c     |  4 ++--
 drivers/power/pmic/max8998.c     |  4 ++--
 drivers/power/pmic/mc34708.c     |  4 ++--
 drivers/power/pmic/palmas.c      |  8 ++++----
 drivers/power/pmic/pfuze100.c    |  6 +++---
 drivers/power/pmic/rk8xx.c       |  6 +++---
 drivers/power/pmic/rn5t567.c     |  4 ++--
 drivers/power/pmic/s2mps11.c     |  8 ++++----
 drivers/power/pmic/s5m8767.c     |  6 +++---
 drivers/power/pmic/sandbox.c     |  4 ++--
 drivers/power/pmic/stpmu1.c      |  2 +-
 drivers/power/pmic/tps65090.c    |  8 ++++----
 18 files changed, 56 insertions(+), 55 deletions(-)

diff --git a/drivers/power/pmic/act8846.c b/drivers/power/pmic/act8846.c
index b0c759c647c..186fa907e18 100644
--- a/drivers/power/pmic/act8846.c
+++ b/drivers/power/pmic/act8846.c
@@ -50,7 +50,7 @@ static int act8846_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
diff --git a/drivers/power/pmic/as3722.c b/drivers/power/pmic/as3722.c
index 63df6133549..54adcbf50f5 100644
--- a/drivers/power/pmic/as3722.c
+++ b/drivers/power/pmic/as3722.c
@@ -45,14 +45,14 @@ static int as3722_read_id(struct udevice *dev, uint *idp, uint *revisionp)
 
 	ret = pmic_reg_read(dev, AS3722_ASIC_ID1);
 	if (ret < 0) {
-		pr_err("failed to read ID1 register: %d", ret);
+		pr_err("failed to read ID1 register: %d\n", ret);
 		return ret;
 	}
 	*idp = ret;
 
 	ret = pmic_reg_read(dev, AS3722_ASIC_ID2);
 	if (ret < 0) {
-		pr_err("failed to read ID2 register: %d", ret);
+		pr_err("failed to read ID2 register: %d\n", ret);
 		return ret;
 	}
 	*revisionp = ret;
@@ -70,7 +70,7 @@ int as3722_sd_set_voltage(struct udevice *dev, unsigned int sd, u8 value)
 
 	ret = pmic_reg_write(dev, AS3722_SD_VOLTAGE(sd), value);
 	if (ret < 0) {
-		pr_err("failed to write SD%u voltage register: %d", sd, ret);
+		pr_err("failed to write SD%u voltage register: %d\n", sd, ret);
 		return ret;
 	}
 
@@ -86,8 +86,8 @@ int as3722_ldo_set_voltage(struct udevice *dev, unsigned int ldo, u8 value)
 
 	ret = pmic_reg_write(dev, AS3722_LDO_VOLTAGE(ldo), value);
 	if (ret < 0) {
-		pr_err("failed to write LDO%u voltage register: %d", ldo,
-		      ret);
+		pr_err("failed to write LDO%u voltage register: %d\n", ldo,
+		       ret);
 		return ret;
 	}
 
@@ -101,12 +101,12 @@ static int as3722_probe(struct udevice *dev)
 
 	ret = as3722_read_id(dev, &id, &revision);
 	if (ret < 0) {
-		pr_err("failed to read ID: %d", ret);
+		pr_err("failed to read ID: %d\n", ret);
 		return ret;
 	}
 
 	if (id != AS3722_DEVICE_ID) {
-		pr_err("unknown device");
+		pr_err("unknown device\n");
 		return -ENOENT;
 	}
 
diff --git a/drivers/power/pmic/as3722_gpio.c b/drivers/power/pmic/as3722_gpio.c
index 36f4fbfa470..96943bc1ad5 100644
--- a/drivers/power/pmic/as3722_gpio.c
+++ b/drivers/power/pmic/as3722_gpio.c
@@ -25,7 +25,7 @@ int as3722_gpio_configure(struct udevice *pmic, unsigned int gpio,
 
 	err = pmic_reg_write(pmic, AS3722_GPIO_CONTROL(gpio), value);
 	if (err) {
-		pr_err("failed to configure GPIO#%u: %d", gpio, err);
+		pr_err("failed to configure GPIO#%u: %d\n", gpio, err);
 		return err;
 	}
 
@@ -45,7 +45,7 @@ static int as3722_gpio_set_value(struct udevice *dev, unsigned int gpio,
 
 	err = pmic_reg_read(pmic, AS3722_GPIO_SIGNAL_OUT);
 	if (err < 0) {
-		pr_err("failed to read GPIO signal out register: %d", err);
+		pr_err("failed to read GPIO signal out register: %d\n", err);
 		return err;
 	}
 	value = err;
@@ -60,7 +60,7 @@ static int as3722_gpio_set_value(struct udevice *dev, unsigned int gpio,
 
 	err = pmic_reg_write(pmic, AS3722_GPIO_SIGNAL_OUT, value);
 	if (err) {
-		pr_err("failed to set GPIO#%u %s: %d", gpio, l, err);
+		pr_err("failed to set GPIO#%u %s: %d\n", gpio, l, err);
 		return err;
 	}
 
@@ -83,13 +83,14 @@ int as3722_gpio_direction_output(struct udevice *dev, unsigned int gpio,
 
 	err = pmic_reg_write(pmic, AS3722_GPIO_CONTROL(gpio), value);
 	if (err) {
-		pr_err("failed to configure GPIO#%u as output: %d", gpio, err);
+		pr_err("failed to configure GPIO#%u as output: %d\n", gpio,
+		       err);
 		return err;
 	}
 
 	err = as3722_gpio_set_value(pmic, gpio, value);
 	if (err < 0) {
-		pr_err("failed to set GPIO#%u high: %d", gpio, err);
+		pr_err("failed to set GPIO#%u high: %d\n", gpio, err);
 		return err;
 	}
 
diff --git a/drivers/power/pmic/lp873x.c b/drivers/power/pmic/lp873x.c
index 432ad4cecf6..4ae4043b943 100644
--- a/drivers/power/pmic/lp873x.c
+++ b/drivers/power/pmic/lp873x.c
@@ -24,7 +24,7 @@ static int lp873x_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!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -34,7 +34,7 @@ static int lp873x_write(struct udevice *dev, uint reg, const uint8_t *buff,
 static int lp873x_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 {
 	if (dm_i2c_read(dev, reg, buff, len)) {
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -48,7 +48,7 @@ static int lp873x_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
diff --git a/drivers/power/pmic/lp87565.c b/drivers/power/pmic/lp87565.c
index 450dbb8a780..3e5fc608d28 100644
--- a/drivers/power/pmic/lp87565.c
+++ b/drivers/power/pmic/lp87565.c
@@ -26,7 +26,7 @@ static int lp87565_write(struct udevice *dev, uint reg, const uint8_t *buff,
 
 	ret = dm_i2c_write(dev, reg, buff, len);
 	if (ret)
-		pr_err("write error to device: %p register: %#x!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
@@ -37,7 +37,7 @@ static int lp87565_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buff, len);
 	if (ret)
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
@@ -49,7 +49,7 @@ static int lp87565_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
diff --git a/drivers/power/pmic/max77686.c b/drivers/power/pmic/max77686.c
index 834713af286..8e3a8cf870b 100644
--- a/drivers/power/pmic/max77686.c
+++ b/drivers/power/pmic/max77686.c
@@ -28,7 +28,7 @@ static int max77686_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!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -38,7 +38,7 @@ static int max77686_write(struct udevice *dev, uint reg, const uint8_t *buff,
 static int max77686_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 {
 	if (dm_i2c_read(dev, reg, buff, len)) {
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -52,8 +52,8 @@ static int max77686_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "voltage-regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
-							     dev->name);
+		debug("%s: %s regulators subnode not found!\n", __func__,
+		      dev->name);
 		return -ENXIO;
 	}
 
diff --git a/drivers/power/pmic/max8997.c b/drivers/power/pmic/max8997.c
index 0dcdbad5832..dbae155fb34 100644
--- a/drivers/power/pmic/max8997.c
+++ b/drivers/power/pmic/max8997.c
@@ -23,7 +23,7 @@ static int max8997_write(struct udevice *dev, uint reg, const uint8_t *buff,
 
 	ret = dm_i2c_write(dev, reg, buff, len);
 	if (ret)
-		pr_err("write error to device: %p register: %#x!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
@@ -34,7 +34,7 @@ static int max8997_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buff, len);
 	if (ret)
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
diff --git a/drivers/power/pmic/max8998.c b/drivers/power/pmic/max8998.c
index f571add6e6a..f58d9f2d74c 100644
--- a/drivers/power/pmic/max8998.c
+++ b/drivers/power/pmic/max8998.c
@@ -23,7 +23,7 @@ static int max8998_write(struct udevice *dev, uint reg, const uint8_t *buff,
 
 	ret = dm_i2c_write(dev, reg, buff, len);
 	if (ret)
-		pr_err("write error to device: %p register: %#x!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
@@ -34,7 +34,7 @@ static int max8998_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buff, len);
 	if (ret)
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
diff --git a/drivers/power/pmic/mc34708.c b/drivers/power/pmic/mc34708.c
index 2b2fc72a472..66253a4a43b 100644
--- a/drivers/power/pmic/mc34708.c
+++ b/drivers/power/pmic/mc34708.c
@@ -38,7 +38,7 @@ static int mc34708_write(struct udevice *dev, uint reg, const u8 *buff,
 
 	ret = dm_i2c_write(dev, reg, buf, len);
 	if (ret)
-		printf("write error to device: %p register: %#x!", dev, reg);
+		printf("write error to device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
@@ -53,7 +53,7 @@ static int mc34708_read(struct udevice *dev, uint reg, u8 *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buf, len);
 	if (ret)
-		printf("read error from device: %p register: %#x!", dev, reg);
+		printf("read error from device: %p register: %#x!\n", dev, reg);
 
 	buff[0] = buf[2];
 	buff[1] = buf[1];
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c
index 250a5d34bbf..36be119b6cf 100644
--- a/drivers/power/pmic/palmas.c
+++ b/drivers/power/pmic/palmas.c
@@ -24,7 +24,7 @@ static int palmas_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!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -34,7 +34,7 @@ static int palmas_write(struct udevice *dev, uint reg, const uint8_t *buff,
 static int palmas_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 {
 	if (dm_i2c_read(dev, reg, buff, len)) {
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -60,14 +60,14 @@ static int palmas_bind(struct udevice *dev)
 	}
 
 	if (!ofnode_valid(pmic_node)) {
-		debug("%s: %s pmic subnode not found!", __func__, dev->name);
+		debug("%s: %s pmic subnode not found!\n", __func__, dev->name);
 		return -ENXIO;
 	}
 
 	regulators_node = ofnode_find_subnode(pmic_node, "regulators");
 
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s reg subnode not found!", __func__, dev->name);
+		debug("%s: %s reg subnode not found!\n", __func__, dev->name);
 		return -ENXIO;
 	}
 
diff --git a/drivers/power/pmic/pfuze100.c b/drivers/power/pmic/pfuze100.c
index 8a5a8996b43..6cf5f35f0f2 100644
--- a/drivers/power/pmic/pfuze100.c
+++ b/drivers/power/pmic/pfuze100.c
@@ -31,7 +31,7 @@ static int pfuze100_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!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -41,7 +41,7 @@ static int pfuze100_write(struct udevice *dev, uint reg, const uint8_t *buff,
 static int pfuze100_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 {
 	if (dm_i2c_read(dev, reg, buff, len)) {
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -55,7 +55,7 @@ static int pfuze100_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
index c60dfff5bfd..25c339ab12c 100644
--- a/drivers/power/pmic/rk8xx.c
+++ b/drivers/power/pmic/rk8xx.c
@@ -29,7 +29,7 @@ static int rk8xx_write(struct udevice *dev, uint reg, const uint8_t *buff,
 
 	ret = dm_i2c_write(dev, reg, buff, len);
 	if (ret) {
-		debug("write error to device: %p register: %#x!", dev, reg);
+		debug("write error to device: %p register: %#x!\n", dev, reg);
 		return ret;
 	}
 
@@ -42,7 +42,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buff, len);
 	if (ret) {
-		debug("read error from device: %p register: %#x!", dev, reg);
+		debug("read error from device: %p register: %#x!\n", dev, reg);
 		return ret;
 	}
 
@@ -57,7 +57,7 @@ static int rk8xx_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
diff --git a/drivers/power/pmic/rn5t567.c b/drivers/power/pmic/rn5t567.c
index c3be3fed4a0..f238396d368 100644
--- a/drivers/power/pmic/rn5t567.c
+++ b/drivers/power/pmic/rn5t567.c
@@ -24,7 +24,7 @@ static int rn5t567_write(struct udevice *dev, uint reg, const uint8_t *buff,
 
 	ret = dm_i2c_write(dev, reg, buff, len);
 	if (ret) {
-		debug("write error to device: %p register: %#x!", dev, reg);
+		debug("write error to device: %p register: %#x!\n", dev, reg);
 		return ret;
 	}
 
@@ -37,7 +37,7 @@ static int rn5t567_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buff, len);
 	if (ret) {
-		debug("read error from device: %p register: %#x!", dev, reg);
+		debug("read error from device: %p register: %#x!\n", dev, reg);
 		return ret;
 	}
 
diff --git a/drivers/power/pmic/s2mps11.c b/drivers/power/pmic/s2mps11.c
index e45d4bc6e16..f2aab6c4570 100644
--- a/drivers/power/pmic/s2mps11.c
+++ b/drivers/power/pmic/s2mps11.c
@@ -30,7 +30,7 @@ static int s2mps11_write(struct udevice *dev, uint reg, const uint8_t *buff,
 
 	ret = dm_i2c_write(dev, reg, buff, len);
 	if (ret)
-		pr_err("write error to device: %p register: %#x!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
@@ -41,7 +41,7 @@ static int s2mps11_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buff, len);
 	if (ret)
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 
 	return ret;
 }
@@ -53,8 +53,8 @@ static int s2mps11_probe(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "voltage-regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
-							     dev->name);
+		debug("%s: %s regulators subnode not found!\n", __func__,
+		      dev->name);
 		return -ENXIO;
 	}
 
diff --git a/drivers/power/pmic/s5m8767.c b/drivers/power/pmic/s5m8767.c
index 54e44ce8645..b5ddd4930e3 100644
--- a/drivers/power/pmic/s5m8767.c
+++ b/drivers/power/pmic/s5m8767.c
@@ -27,7 +27,7 @@ static int s5m8767_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!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -37,7 +37,7 @@ static int s5m8767_write(struct udevice *dev, uint reg, const uint8_t *buff,
 static int s5m8767_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 {
 	if (dm_i2c_read(dev, reg, buff, len)) {
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -56,7 +56,7 @@ static int s5m8767_bind(struct udevice *dev)
 
 	node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
diff --git a/drivers/power/pmic/sandbox.c b/drivers/power/pmic/sandbox.c
index 64e2f276dab..d7870915de8 100644
--- a/drivers/power/pmic/sandbox.c
+++ b/drivers/power/pmic/sandbox.c
@@ -28,7 +28,7 @@ static int sandbox_pmic_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!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -39,7 +39,7 @@ static int sandbox_pmic_read(struct udevice *dev, uint reg,
 			     uint8_t *buff, int len)
 {
 	if (dm_i2c_read(dev, reg, buff, len)) {
-		pr_err("read error from device: %p register: %#x!", dev, reg);
+		pr_err("read error from device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
diff --git a/drivers/power/pmic/stpmu1.c b/drivers/power/pmic/stpmu1.c
index 82351b66137..47af0123328 100644
--- a/drivers/power/pmic/stpmu1.c
+++ b/drivers/power/pmic/stpmu1.c
@@ -61,7 +61,7 @@ static int stpmu1_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		dev_dbg(dev, "regulators subnode not found!");
+		dev_dbg(dev, "regulators subnode not found!\n");
 		return -ENXIO;
 	}
 	dev_dbg(dev, "found regulators subnode\n");
diff --git a/drivers/power/pmic/tps65090.c b/drivers/power/pmic/tps65090.c
index 1d3bf00b568..5b1d19f3e0b 100644
--- a/drivers/power/pmic/tps65090.c
+++ b/drivers/power/pmic/tps65090.c
@@ -26,7 +26,7 @@ static int tps65090_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!", dev, reg);
+		pr_err("write error to device: %p register: %#x!\n", dev, reg);
 		return -EIO;
 	}
 
@@ -39,8 +39,8 @@ static int tps65090_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 	ret = dm_i2c_read(dev, reg, buff, len);
 	if (ret) {
-		pr_err("read error %d from device: %p register: %#x!", ret, dev,
-		      reg);
+		pr_err("read error %d from device: %p register: %#x!\n", ret,
+		       dev, reg);
 		return -EIO;
 	}
 
@@ -54,7 +54,7 @@ static int tps65090_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (2 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle() Simon Glass
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

At present tests are quite slow to run, over a minute on my machine. This
presents a considerable barrier to bisecting for failures.

The slowest tests are the filesystem ones and the buildman --fetch-arch
test. Add a new 'qcheck' target that skips these tests. This reduces test
time down to about 40 second, still too long, but bearable.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 Makefile                             |  6 +++++-
 test/README                          |  6 +++++-
 test/py/tests/test_fs/test_basic.py  |  1 +
 test/py/tests/test_fs/test_ext.py    |  1 +
 test/py/tests/test_fs/test_mkdir.py  |  1 +
 test/py/tests/test_fs/test_unlink.py |  1 +
 test/run                             | 10 ++++++++--
 7 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 552687db538..15b710b214e 100644
--- a/Makefile
+++ b/Makefile
@@ -443,7 +443,7 @@ defaultenv_h := include/generated/defaultenv_autogenerated.h
 
 no-dot-config-targets := clean clobber mrproper distclean \
 			 help %docs check% coccicheck \
-			 ubootversion backup tests
+			 ubootversion backup tests check qcheck
 
 config-targets := 0
 mixed-targets  := 0
@@ -1703,6 +1703,7 @@ help:
 	@echo  'Test targets:'
 	@echo  ''
 	@echo  '  check           - Run all automated tests that use sandbox'
+	@echo  '  qcheck          - Run quick automated tests that use sandbox'
 	@echo  ''
 	@echo  'Other generic targets:'
 	@echo  '  all		  - Build all necessary images depending on configuration'
@@ -1745,6 +1746,9 @@ help:
 tests check:
 	$(srctree)/test/run
 
+qcheck:
+	$(srctree)/test/run quick
+
 # Documentation targets
 # ---------------------------------------------------------------------------
 DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
diff --git a/test/README b/test/README
index 873a4e19313..4bc9ca3a6ae 100644
--- a/test/README
+++ b/test/README
@@ -10,11 +10,15 @@ Running tests
 
 To run most tests on sandbox, type this:
 
-    test/run
+    make check
 
 in the U-Boot directory. Note that only the pytest suite is run using this
 command.
 
+Some tests take ages to run. To run just the quick ones, type this:
+
+    make qcheck
+
 
 Sandbox
 -------
diff --git a/test/py/tests/test_fs/test_basic.py b/test/py/tests/test_fs/test_basic.py
index c067cc9ba3f..140ca29ac73 100644
--- a/test/py/tests/test_fs/test_basic.py
+++ b/test/py/tests/test_fs/test_basic.py
@@ -13,6 +13,7 @@ import re
 from fstest_defs import *
 
 @pytest.mark.boardspec('sandbox')
+ at pytest.mark.slow
 class TestFsBasic(object):
     def test_fs1(self, u_boot_console, fs_obj_basic):
         """
diff --git a/test/py/tests/test_fs/test_ext.py b/test/py/tests/test_fs/test_ext.py
index 38217d08bf6..06cad5516d5 100644
--- a/test/py/tests/test_fs/test_ext.py
+++ b/test/py/tests/test_fs/test_ext.py
@@ -13,6 +13,7 @@ import re
 from fstest_defs import *
 
 @pytest.mark.boardspec('sandbox')
+ at pytest.mark.slow
 class TestFsExt(object):
     def test_fs_ext1(self, u_boot_console, fs_obj_ext):
         """
diff --git a/test/py/tests/test_fs/test_mkdir.py b/test/py/tests/test_fs/test_mkdir.py
index d9da97b56b5..b3fe11cf3b5 100644
--- a/test/py/tests/test_fs/test_mkdir.py
+++ b/test/py/tests/test_fs/test_mkdir.py
@@ -11,6 +11,7 @@ This test verifies mkdir operation on file system.
 import pytest
 
 @pytest.mark.boardspec('sandbox')
+ at pytest.mark.slow
 class TestMkdir(object):
     def test_mkdir1(self, u_boot_console, fs_obj_mkdir):
         """
diff --git a/test/py/tests/test_fs/test_unlink.py b/test/py/tests/test_fs/test_unlink.py
index 69c1a6e078c..2b817468eda 100644
--- a/test/py/tests/test_fs/test_unlink.py
+++ b/test/py/tests/test_fs/test_unlink.py
@@ -12,6 +12,7 @@ on file system.
 import pytest
 
 @pytest.mark.boardspec('sandbox')
+ at pytest.mark.slow
 class TestUnlink(object):
     def test_unlink1(self, u_boot_console, fs_obj_unlink):
         """
diff --git a/test/run b/test/run
index fb8ff5da0cb..c212cfe7916 100755
--- a/test/run
+++ b/test/run
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # Script to run all U-Boot tests that use sandbox.
+#  $1: tests to run (empty for all, 'quick' for quick ones only)
 
 # Runs a test and checks the exit code to decide if it passed
 #  $1:         Test name
@@ -12,10 +13,13 @@ run_test() {
 	[ $? -ne 0 ] && failures=$((failures+1))
 }
 
+# SKip slow tests if requested
+[ "$1" == "quick" ] && mark_expr="not slow"
+
 failures=0
 
 # Run all tests that the standard sandbox build can support
-run_test "sandbox" ./test/py/test.py --bd sandbox --build
+run_test "sandbox" ./test/py/test.py --bd sandbox --build -m "${mark_expr}"
 
 # Run tests which require sandbox_spl
 run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \
@@ -36,7 +40,9 @@ export DTC=${DTC_DIR}/dtc
 
 run_test "binman" ./tools/binman/binman -t
 run_test "patman" ./tools/patman/patman --test
-run_test "buildman" ./tools/buildman/buildman -t
+
+[ "$1" == "quick" ] && skip=--skip-net-tests
+run_test "buildman" ./tools/buildman/buildman -t ${skip}
 run_test "fdt" ./tools/dtoc/test_fdt -t
 run_test "dtoc" ./tools/dtoc/dtoc -t
 
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle()
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (3 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions Simon Glass
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

This function may be useful to code outside of the code driver-model
implementation. Export it and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/core/uclass.c        |  6 ++----
 include/dm/uclass-internal.h | 17 +++++++++++++++++
 test/dm/test-fdt.c           | 20 ++++++++++++++++++++
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index d9c5719a878..9766aeabd19 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -354,10 +354,8 @@ done:
 }
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
-static int uclass_find_device_by_phandle(enum uclass_id id,
-					 struct udevice *parent,
-					 const char *name,
-					 struct udevice **devp)
+int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent,
+				  const char *name, struct udevice **devp)
 {
 	struct udevice *dev;
 	struct uclass *uc;
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index 30d5a4fb9bf..8a4839ee882 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -142,6 +142,23 @@ int uclass_find_device_by_of_offset(enum uclass_id id, int node,
 int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node,
 				 struct udevice **devp);
 
+/**
+ * uclass_find_device_by_phandle() - Find a uclass device by phandle
+ *
+ * This searches the devices in the uclass for one with the given phandle.
+ *
+ * The device is NOT probed, it is merely returned.
+ *
+ * @id: ID to look up
+ * @parent: Parent device containing the phandle pointer
+ * @name: Name of property in the parent device node
+ * @devp: Returns pointer to device (there is only one for each node)
+ * @return 0 if OK, -ENOENT if there is no @name present in the node, other
+ *	-ve on error
+ */
+int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent,
+				  const char *name, struct udevice **devp);
+
 /**
  * uclass_bind_device() - Associate device with a uclass
  *
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index e43acb21d5e..b70e3fa18ac 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -611,3 +611,23 @@ static int dm_test_fdt_disable_enable_by_path(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_fdt_disable_enable_by_path, DM_TESTF_SCAN_PDATA |
 					    DM_TESTF_SCAN_FDT);
+
+/* Test a few uclass phandle functions */
+static int dm_test_fdt_phandle(struct unit_test_state *uts)
+{
+	struct udevice *back, *dev, *dev2;
+
+	ut_assertok(uclass_find_first_device(UCLASS_PANEL_BACKLIGHT, &back));
+	ut_asserteq(-ENOENT, uclass_find_device_by_phandle(UCLASS_REGULATOR,
+							back, "missing", &dev));
+	ut_assertok(uclass_find_device_by_phandle(UCLASS_REGULATOR, back,
+						  "power-supply", &dev));
+	ut_asserteq(0, device_active(dev));
+	ut_asserteq_str("ldo1", dev->name);
+	ut_assertok(uclass_get_device_by_phandle(UCLASS_REGULATOR, back,
+						 "power-supply", &dev2));
+	ut_asserteq_ptr(dev, dev2);
+
+	return 0;
+}
+DM_TEST(dm_test_fdt_phandle, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (4 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle() Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order Simon Glass
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

Add two functions which can find a child device by uclass or by name.
The first is useful with Multi-Function-Devices (MFDs) to find one of a
particular type. The second is useful when only the name is known.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/core/device.c | 34 ++++++++++++++++++++++++++++++++++
 include/dm/device.h   | 25 +++++++++++++++++++++++++
 test/dm/test-fdt.c    | 27 +++++++++++++++++++++++++++
 3 files changed, 86 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 47a697f3e5c..836bcadced5 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -699,6 +699,40 @@ int device_find_first_inactive_child(struct udevice *parent,
 	return -ENODEV;
 }
 
+int device_find_first_child_by_uclass(struct udevice *parent,
+				      enum uclass_id uclass_id,
+				      struct udevice **devp)
+{
+	struct udevice *dev;
+
+	*devp = NULL;
+	list_for_each_entry(dev, &parent->child_head, sibling_node) {
+		if (device_get_uclass_id(dev) == uclass_id) {
+			*devp = dev;
+			return 0;
+		}
+	}
+
+	return -ENODEV;
+}
+
+int device_find_child_by_name(struct udevice *parent, const char *name,
+			      struct udevice **devp)
+{
+	struct udevice *dev;
+
+	*devp = NULL;
+
+	list_for_each_entry(dev, &parent->child_head, sibling_node) {
+		if (!strcmp(dev->name, name)) {
+			*devp = dev;
+			return 0;
+		}
+	}
+
+	return -ENODEV;
+}
+
 struct udevice *dev_get_parent(const struct udevice *child)
 {
 	return child->parent;
diff --git a/include/dm/device.h b/include/dm/device.h
index 847934425bb..27a6d7b9fdb 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -525,6 +525,8 @@ int device_find_next_child(struct udevice **devp);
  * This is used to locate an existing child of a device which is of a given
  * uclass.
  *
+ * The device is NOT probed
+ *
  * @parent:	Parent device to search
  * @uclass_id:	Uclass to look for
  * @devp:	Returns device found, if any
@@ -534,6 +536,29 @@ int device_find_first_inactive_child(struct udevice *parent,
 				     enum uclass_id uclass_id,
 				     struct udevice **devp);
 
+/**
+ * device_find_first_child_by_uclass() - Find the first child of a device in uc
+ *
+ * @parent: Parent device to search
+ * @uclass_id:	Uclass to look for
+ * @devp: Returns first child device in that uclass, if any
+ * @return 0 if found, else -ENODEV
+ */
+int device_find_first_child_by_uclass(struct udevice *parent,
+				      enum uclass_id uclass_id,
+				      struct udevice **devp);
+
+/**
+ * device_find_child_by_name() - Find a child by device name
+ *
+ * @parent:	Parent device to search
+ * @name:	Name to look for
+ * @devp:	Returns device found, if any
+ * @return 0 if found, else -ENODEV
+ */
+int device_find_child_by_name(struct udevice *parent, const char *name,
+			      struct udevice **devp);
+
 /**
  * device_has_children() - check if a device has any children
  *
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index b70e3fa18ac..0fbd9be765a 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -631,3 +631,30 @@ static int dm_test_fdt_phandle(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_fdt_phandle, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test device_find_first_child_by_uclass() */
+static int dm_test_first_child(struct unit_test_state *uts)
+{
+	struct udevice *i2c, *dev, *dev2;
+
+	ut_assertok(uclass_first_device_err(UCLASS_I2C, &i2c));
+	ut_assertok(device_find_first_child_by_uclass(i2c, UCLASS_RTC, &dev));
+	ut_asserteq_str("rtc at 43", dev->name);
+	ut_assertok(device_find_child_by_name(i2c, "rtc at 43", &dev2));
+	ut_asserteq_ptr(dev, dev2);
+	ut_assertok(device_find_child_by_name(i2c, "rtc at 61", &dev2));
+	ut_asserteq_str("rtc at 61", dev2->name);
+
+	ut_assertok(device_find_first_child_by_uclass(i2c, UCLASS_I2C_EEPROM,
+						      &dev));
+	ut_asserteq_str("eeprom at 2c", dev->name);
+	ut_assertok(device_find_child_by_name(i2c, "eeprom at 2c", &dev2));
+	ut_asserteq_ptr(dev, dev2);
+
+	ut_asserteq(-ENODEV, device_find_first_child_by_uclass(i2c,
+							UCLASS_VIDEO, &dev));
+	ut_asserteq(-ENODEV, device_find_child_by_name(i2c, "missing", &dev));
+
+	return 0;
+}
+DM_TEST(dm_test_first_child, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (5 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass Simon Glass
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

This is currently at the top in the space for internal use. But this
uclass is used outside driver model and test code. Move it into the
correct alpha order.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 include/dm/uclass-id.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index c91dca1f824..cd4387e5ae2 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -24,7 +24,6 @@ enum uclass_id {
 	UCLASS_PCI_EMUL,	/* sandbox PCI device emulator */
 	UCLASS_USB_EMUL,	/* sandbox USB bus device emulator */
 	UCLASS_AXI_EMUL,	/* sandbox AXI bus device emulator */
-	UCLASS_SIMPLE_BUS,	/* bus with child devices */
 
 	/* U-Boot uclasses start here - in alphabetical order */
 	UCLASS_ADC,		/* Analog-to-digital converter */
@@ -78,6 +77,7 @@ enum uclass_id {
 	UCLASS_RTC,		/* Real time clock device */
 	UCLASS_SCSI,		/* SCSI device */
 	UCLASS_SERIAL,		/* Serial UART */
+	UCLASS_SIMPLE_BUS,	/* Bus with child devices */
 	UCLASS_SMEM,		/* Shared memory interface */
 	UCLASS_SPI,		/* SPI bus */
 	UCLASS_SPMI,		/* System Power Management Interface bus */
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (6 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass Simon Glass
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

Sandbox i2c works using emulation drivers which are currently children of
the i2c device:

	rtc_0: rtc at 43 {
		reg = <0x43>;
		compatible = "sandbox-rtc";
		emul {
			compatible = "sandbox,i2c-rtc";
		};
	};

In this case the emulation device is attached to i2c bus on address 0x43
and provides the Real-Time-Clock (RTC) functionality.

However this is not ideal, since every device on an I2C bus has a child
device. This is only really the case for sandbox, but we want to avoid
special-case code for sandbox.

A better approach seems to be to add a separate node on the bus, an
'emulation parent'. This can be given a bogus address (such as 0xff) and
hides all the emulators away. Then we can use a phandle to point from the
device to the correct emualtor, and only on sandbox. The code to find an
emulator does not interfere with normal i2c operation.

Add a new UCLASS_I2C_EMUL_PARENT uclass which allows finding an emulator
given a bus, and finding a bus given an emulator. This will be used in a
follow-on patch.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/i2c/i2c-emul-uclass.c | 77 +++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h        |  1 +
 include/i2c.h                 | 21 ++++++++++
 3 files changed, 99 insertions(+)

diff --git a/drivers/i2c/i2c-emul-uclass.c b/drivers/i2c/i2c-emul-uclass.c
index a2bdd5aa844..ae5aae03e72 100644
--- a/drivers/i2c/i2c-emul-uclass.c
+++ b/drivers/i2c/i2c-emul-uclass.c
@@ -6,8 +6,85 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <dm/device-internal.h>
+#include <dm/uclass-internal.h>
+
+/*
+ * i2c emulation works using an 'emul' node at the bus level. Each device in
+ * that node is in the UCLASS_I2C_EMUL uclass, and emulates one i2c device. A
+ * pointer to the device it emulates is in the 'dev' property of the emul device
+ * uclass platdata (struct i2c_emul_platdata), put there by i2c_emul_find().
+ * When sandbox wants an emulator for a device, it calls i2c_emul_find() which
+ * searches for the emulator with the correct address. To find the device for an
+ * emulator, call i2c_emul_get_device().
+ *
+ * The 'emul' node is in the UCLASS_I2C_EMUL_PARENT uclass. We use a separate
+ * uclass so avoid having strange devices on the I2C bus.
+ */
+
+/**
+ * struct i2c_emul_uc_platdata - information about the emulator for this device
+ *
+ * This is used by devices in UCLASS_I2C_EMUL to record information about the
+ * device being emulated. It is accessible with dev_get_uclass_platdata()
+ *
+ * @dev: Device being emulated
+ */
+struct i2c_emul_uc_platdata {
+	struct udevice *dev;
+};
+
+struct udevice *i2c_emul_get_device(struct udevice *emul)
+{
+	struct i2c_emul_uc_platdata *uc_plat = dev_get_uclass_platdata(emul);
+
+	return uc_plat->dev;
+}
+
+int i2c_emul_find(struct udevice *dev, struct udevice **emulp)
+{
+	struct i2c_emul_uc_platdata *uc_plat;
+	struct udevice *emul;
+	int ret;
+
+	ret = uclass_find_device_by_phandle(UCLASS_I2C_EMUL, dev,
+					    "sandbox,emul", &emul);
+	if (ret) {
+		log_err("No emulators for device '%s'\n", dev->name);
+		return ret;
+	}
+	uc_plat = dev_get_uclass_platdata(emul);
+	uc_plat->dev = dev;
+	*emulp = emul;
+
+	return device_probe(emul);
+}
 
 UCLASS_DRIVER(i2c_emul) = {
 	.id		= UCLASS_I2C_EMUL,
 	.name		= "i2c_emul",
+	.per_device_platdata_auto_alloc_size =
+		 sizeof(struct i2c_emul_uc_platdata),
+};
+
+/*
+ * This uclass is a child of the i2c bus. Its platdata is not defined here so
+ * is defined by its parent, UCLASS_I2C, which uses struct dm_i2c_chip. See
+ * per_child_platdata_auto_alloc_size in UCLASS_DRIVER(i2c).
+ */
+UCLASS_DRIVER(i2c_emul_parent) = {
+	.id		= UCLASS_I2C_EMUL_PARENT,
+	.name		= "i2c_emul_parent",
+	.post_bind	= dm_scan_fdt_dev,
+};
+
+static const struct udevice_id i2c_emul_parent_ids[] = {
+	{ .compatible = "sandbox,i2c-emul-parent" },
+	{ }
+};
+
+U_BOOT_DRIVER(i2c_emul_parent_drv) = {
+	.name		= "i2c_emul_parent_drv",
+	.id		= UCLASS_I2C_EMUL_PARENT,
+	.of_match	= i2c_emul_parent_ids,
 };
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index cd4387e5ae2..a5fcb69dbad 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -21,6 +21,7 @@ enum uclass_id {
 	UCLASS_TEST_DUMMY,
 	UCLASS_SPI_EMUL,	/* sandbox SPI device emulator */
 	UCLASS_I2C_EMUL,	/* sandbox I2C device emulator */
+	UCLASS_I2C_EMUL_PARENT,	/* parent for I2C device emulators */
 	UCLASS_PCI_EMUL,	/* sandbox PCI device emulator */
 	UCLASS_USB_EMUL,	/* sandbox USB bus device emulator */
 	UCLASS_AXI_EMUL,	/* sandbox AXI bus device emulator */
diff --git a/include/i2c.h b/include/i2c.h
index d33f827500b..ccffc195527 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -536,6 +536,27 @@ int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip);
  */
 void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs);
 
+/**
+ * i2c_emul_find() - Find an emulator for an i2c sandbox device
+ *
+ * This looks at the device's 'emul' phandle
+ *
+ * @dev: Device to find an emulator for
+ * @emulp: Returns the associated emulator, if found *
+ * @return 0 if OK, -ENOENT or -ENODEV if not found
+ */
+int i2c_emul_find(struct udevice *dev, struct udevice **emulp);
+
+/**
+ * i2c_emul_get_device() - Find the device being emulated
+ *
+ * Given an emulator this returns the associated device
+ *
+ * @emul: Emulator for the device
+ * @return device that @emul is emulating
+ */
+struct udevice *i2c_emul_get_device(struct udevice *emul);
+
 #ifndef CONFIG_DM_I2C
 
 /*
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (7 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 10/10] rtc: Allow child drivers Simon Glass
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

Update the device tree, sandbox i2c driver and tests to use the new
emulation parent to hold emulators.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/sandbox/dts/sandbox.dts       | 25 +++++++----
 arch/sandbox/dts/sandbox_pmic.dtsi | 71 +++++++++++++++---------------
 arch/sandbox/dts/test.dts          | 30 +++++++++----
 drivers/i2c/sandbox_i2c.c          | 20 +--------
 drivers/power/pmic/i2c_pmic_emul.c |  2 +-
 test/dm/i2c.c                      |  2 +-
 test/dm/rtc.c                      |  9 ++--
 7 files changed, 82 insertions(+), 77 deletions(-)

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index fb866e88079..eda01893b49 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -91,19 +91,11 @@
 		eeprom at 2c {
 			reg = <0x2c>;
 			compatible = "i2c-eeprom";
-			emul {
-				compatible = "sandbox,i2c-eeprom";
-				sandbox,filename = "i2c.bin";
-				sandbox,size = <128>;
-			};
 		};
 
 		rtc_0: rtc at 43 {
 			reg = <0x43>;
 			compatible = "sandbox-rtc";
-			emul {
-				compatible = "sandbox,i2c-rtc";
-			};
 		};
 		sandbox_pmic: sandbox_pmic {
 			reg = <0x40>;
@@ -112,6 +104,23 @@
 		mc34708: pmic at 41 {
 			reg = <0x41>;
 		};
+
+		i2c_emul: emul {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0xff>;
+			compatible = "sandbox,i2c-emul-parent";
+			emul-eeprom {
+				reg = <0x2c>;
+				compatible = "sandbox,i2c-eeprom";
+				sandbox,filename = "i2c.bin";
+				sandbox,size = <256>;
+			};
+			emul0 {
+				reg = <0x43>;
+				compatible = "sandbox,i2c-rtc";
+			};
+		};
 	};
 
 	lcd {
diff --git a/arch/sandbox/dts/sandbox_pmic.dtsi b/arch/sandbox/dts/sandbox_pmic.dtsi
index 5ecafaab364..565c382ed45 100644
--- a/arch/sandbox/dts/sandbox_pmic.dtsi
+++ b/arch/sandbox/dts/sandbox_pmic.dtsi
@@ -11,40 +11,6 @@
 &sandbox_pmic {
 	compatible = "sandbox,pmic";
 
-	pmic_emul {
-		compatible = "sandbox,i2c-pmic";
-
-		/*
-		 * Default PMICs register values are set by macro
-		 * VAL2REG(min, step, value) [uV/uA]
-		 * VAL2OMREG(mode id)
-		 * reg-defaults - byte array
-		 */
-		reg-defaults = /bits/ 8 <
-			/* BUCK1 */
-			VAL2REG(800000, 25000, 1000000)
-			VAL2REG(150000, 25000, 150000)
-			VAL2OMREG(BUCK_OM_OFF)
-			/* BUCK2 */
-			VAL2REG(750000, 50000, 3000000)
-			VAL2REG(150000, 25000, 150000)
-			VAL2OMREG(0)
-			/* LDO1 */
-			VAL2REG(800000, 25000, 1600000)
-			VAL2REG(100000, 50000, 150000)
-			VAL2OMREG(LDO_OM_OFF)
-			/* LDO2 */
-			VAL2REG(750000, 50000, 3000000)
-			VAL2REG(150000, 25000, 150000)
-			VAL2OMREG(0)
-			/* reg[12:15] - not used */
-			0x00
-			0x00
-			0x00
-			0x00
-		>;
-	};
-
 	buck1 {
 		regulator-name = "SUPPLY_1.2V";
 		regulator-min-microvolt = <1200000>;
@@ -84,10 +50,45 @@
 
 &mc34708 {
 	compatible = "fsl,mc34708";
+};
 
-	pmic_emul {
+&i2c_emul {
+	emul_pmic0: pmic-emul0 {
 		compatible = "sandbox,i2c-pmic";
 
+		/*
+		 * Default PMICs register values are set by macro
+		 * VAL2REG(min, step, value) [uV/uA]
+		 * VAL2OMREG(mode id)
+		 * reg-defaults - byte array
+		 */
+		reg-defaults = /bits/ 8 <
+			/* BUCK1 */
+			VAL2REG(800000, 25000, 1000000)
+			VAL2REG(150000, 25000, 150000)
+			VAL2OMREG(BUCK_OM_OFF)
+			/* BUCK2 */
+			VAL2REG(750000, 50000, 3000000)
+			VAL2REG(150000, 25000, 150000)
+			VAL2OMREG(0)
+			/* LDO1 */
+			VAL2REG(800000, 25000, 1600000)
+			VAL2REG(100000, 50000, 150000)
+			VAL2OMREG(LDO_OM_OFF)
+			/* LDO2 */
+			VAL2REG(750000, 50000, 3000000)
+			VAL2REG(150000, 25000, 150000)
+			VAL2OMREG(0)
+			/* reg[12:15] - not used */
+			0x00
+			0x00
+			0x00
+			0x00
+		>;
+	};
+
+	emul_pmic1: pmic-emul1 {
+		compatible = "sandbox,i2c-pmic";
 		reg-defaults = /bits/ 8 <
 			0x00 0x80 0x08 0xff 0xff 0xff 0x2e 0x01 0x08
 			0x40 0x80 0x81 0x5f 0xff 0xfb 0x1e 0x80 0x18
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 2c6b4223123..e4519ad48e9 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -266,35 +266,47 @@
 		eeprom@2c {
 			reg = <0x2c>;
 			compatible = "i2c-eeprom";
-			emul {
-				compatible = "sandbox,i2c-eeprom";
-				sandbox,filename = "i2c.bin";
-				sandbox,size = <256>;
-			};
+			sandbox,emul = <&emul_eeprom>;
 		};
 
 		rtc_0: rtc at 43 {
 			reg = <0x43>;
 			compatible = "sandbox-rtc";
-			emul {
-				compatible = "sandbox,i2c-rtc";
-			};
+			sandbox,emul = <&emul0>;
 		};
 
 		rtc_1: rtc at 61 {
 			reg = <0x61>;
 			compatible = "sandbox-rtc";
-			emul {
+			sandbox,emul = <&emul1>;
+		};
+
+		i2c_emul: emul {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0xff>;
+			compatible = "sandbox,i2c-emul-parent";
+			emul_eeprom: emul-eeprom {
+				compatible = "sandbox,i2c-eeprom";
+				sandbox,filename = "i2c.bin";
+				sandbox,size = <256>;
+			};
+			emul0: emul0 {
+				compatible = "sandbox,i2c-rtc";
+			};
+			emul1: emull {
 				compatible = "sandbox,i2c-rtc";
 			};
 		};
 
 		sandbox_pmic: sandbox_pmic {
 			reg = <0x40>;
+			sandbox,emul = <&emul_pmic0>;
 		};
 
 		mc34708: pmic at 41 {
 			reg = <0x41>;
+			sandbox,emul = <&emul_pmic1>;
 		};
 	};
 
diff --git a/drivers/i2c/sandbox_i2c.c b/drivers/i2c/sandbox_i2c.c
index 66578510849..0dbbaa0c447 100644
--- a/drivers/i2c/sandbox_i2c.c
+++ b/drivers/i2c/sandbox_i2c.c
@@ -21,33 +21,15 @@ static int get_emul(struct udevice *dev, struct udevice **devp,
 		    struct dm_i2c_ops **opsp)
 {
 	struct dm_i2c_chip *plat;
-	struct udevice *child;
 	int ret;
 
 	*devp = NULL;
 	*opsp = NULL;
 	plat = dev_get_parent_platdata(dev);
 	if (!plat->emul) {
-		ret = dm_scan_fdt_dev(dev);
+		ret = i2c_emul_find(dev, &plat->emul);
 		if (ret)
 			return ret;
-
-		for (device_find_first_child(dev, &child); child;
-		     device_find_next_child(&child)) {
-			if (device_get_uclass_id(child) != UCLASS_I2C_EMUL)
-				continue;
-
-			ret = device_probe(child);
-			if (ret)
-				return ret;
-
-			break;
-		}
-
-		if (child)
-			plat->emul = child;
-		else
-			return -ENODEV;
 	}
 	*devp = plat->emul;
 	*opsp = i2c_get_ops(plat->emul);
diff --git a/drivers/power/pmic/i2c_pmic_emul.c b/drivers/power/pmic/i2c_pmic_emul.c
index 61fa76a5619..80efc0265d9 100644
--- a/drivers/power/pmic/i2c_pmic_emul.c
+++ b/drivers/power/pmic/i2c_pmic_emul.c
@@ -104,7 +104,7 @@ static int sandbox_i2c_pmic_xfer(struct udevice *emul, struct i2c_msg *msg,
 static int sandbox_i2c_pmic_ofdata_to_platdata(struct udevice *emul)
 {
 	struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul);
-	struct udevice *pmic_dev = dev_get_parent(emul);
+	struct udevice *pmic_dev = i2c_emul_get_device(emul);
 	struct uc_pmic_priv *priv = dev_get_uclass_priv(pmic_dev);
 	const u8 *reg_defaults;
 
diff --git a/test/dm/i2c.c b/test/dm/i2c.c
index 772f62b265d..cbbd4aa29a1 100644
--- a/test/dm/i2c.c
+++ b/test/dm/i2c.c
@@ -35,7 +35,7 @@ static int dm_test_i2c_find(struct unit_test_state *uts)
 	 */
 	ut_assertok(uclass_get_device_by_seq(UCLASS_I2C, busnum, &bus));
 	ut_assertok(dm_i2c_probe(bus, chip, 0, &dev));
-	ut_asserteq(-ENODEV, dm_i2c_probe(bus, no_chip, 0, &dev));
+	ut_asserteq(-ENOENT, dm_i2c_probe(bus, no_chip, 0, &dev));
 	ut_asserteq(-ENODEV, uclass_get_device_by_seq(UCLASS_I2C, 1, &bus));
 
 	return 0;
diff --git a/test/dm/rtc.c b/test/dm/rtc.c
index e2bc648fdcf..71887427647 100644
--- a/test/dm/rtc.c
+++ b/test/dm/rtc.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <i2c.h>
 #include <rtc.h>
 #include <asm/io.h>
 #include <asm/test.h>
@@ -60,7 +61,7 @@ static int dm_test_rtc_set_get(struct unit_test_state *uts)
 	ut_assertok(uclass_get_device(UCLASS_RTC, 0, &dev));
 	ut_assertok(dm_rtc_get(dev, &now));
 
-	ut_assertok(device_find_first_child(dev, &emul));
+	ut_assertok(i2c_emul_find(dev, &emul));
 	ut_assert(emul != NULL);
 
 	/* Tell the RTC to go into manual mode */
@@ -125,7 +126,7 @@ static int dm_test_rtc_reset(struct unit_test_state *uts)
 	ut_assertok(uclass_get_device(UCLASS_RTC, 0, &dev));
 	ut_assertok(dm_rtc_get(dev, &now));
 
-	ut_assertok(device_find_first_child(dev, &emul));
+	ut_assertok(i2c_emul_find(dev, &emul));
 	ut_assert(emul != NULL);
 
 	old_base_time = sandbox_i2c_rtc_get_set_base_time(emul, 0);
@@ -154,9 +155,9 @@ static int dm_test_rtc_dual(struct unit_test_state *uts)
 	ut_assertok(uclass_get_device(UCLASS_RTC, 1, &dev2));
 	ut_assertok(dm_rtc_get(dev2, &now2));
 
-	ut_assertok(device_find_first_child(dev1, &emul1));
+	ut_assertok(i2c_emul_find(dev1, &emul1));
 	ut_assert(emul1 != NULL);
-	ut_assertok(device_find_first_child(dev2, &emul2));
+	ut_assertok(i2c_emul_find(dev2, &emul2));
 	ut_assert(emul2 != NULL);
 
 	offset = sandbox_i2c_rtc_set_offset(emul1, false, -1);
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 10/10] rtc: Allow child drivers
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (8 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass Simon Glass
@ 2018-11-18 15:14 ` Simon Glass
  2018-11-29 17:39 ` sjg at google.com
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2018-11-18 15:14 UTC (permalink / raw)
  To: u-boot

Some RTC chips have child drivers, e.g. to provide access to their
non-volatile RAM. Scan for these when binding.

Signed-off-by: Simon Glass <sjg@chromium.org>

---

Changes in v2:
- Drop patches previously applied
- Add new patches to support the RTC change

 drivers/rtc/rtc-uclass.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index c676f0ff359..a0a238aedda 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -122,4 +122,5 @@ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value)
 UCLASS_DRIVER(rtc) = {
 	.name		= "rtc",
 	.id		= UCLASS_RTC,
+	.post_bind	= dm_scan_fdt_dev,
 };
-- 
2.19.1.1215.g8438c0b245-goog

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output Simon Glass
@ 2018-11-18 21:17   ` Lukasz Majewski
  2018-11-29 17:39   ` sjg at google.com
  1 sibling, 0 replies; 25+ messages in thread
From: Lukasz Majewski @ 2018-11-18 21:17 UTC (permalink / raw)
  To: u-boot

On Sun, 18 Nov 2018 08:14:28 -0700
Simon Glass <sjg@chromium.org> wrote:

> There is a newline missing from quite a few printf() strings in these
> pmic files. Fix them.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181118/7619856d/attachment.sig>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL Simon Glass
@ 2018-11-20 13:49   ` Jean-Jacques Hiblot
  2019-01-31  2:57     ` Simon Glass
  0 siblings, 1 reply; 25+ messages in thread
From: Jean-Jacques Hiblot @ 2018-11-20 13:49 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 18/11/2018 16:14, Simon Glass wrote:
> In some cases it is necessary to read the keyboard in early phases of
> U-Boot. The cros_ec keyboard is kept in the misc directory. Update the
> config to allow this.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Leave the misc uclass alone since it stops sandbox_spl working
>
>   drivers/misc/Kconfig  | 72 +++++++++++++++++++++++++++++++++++++++++++
>   drivers/misc/Makefile |  8 +++--
>   2 files changed, 77 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 48febc47d26..802046cf966 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -13,6 +13,24 @@ config MISC
>   	  set of generic read, write and ioctl methods may be used to
>   	  access the device.
>   
> +config SPL_MISC
> +	bool "Enable Driver Model for Misc drivers in SPL"
> +	depends on SPL_DM
> +	help
> +	  Enable driver model for miscellaneous devices. This class is
> +	  used only for those do not fit other more general classes. A
> +	  set of generic read, write and ioctl methods may be used to
> +	  access the device.

Platforms currently use CONFIG_SPL_DRIVERS_MISC_SUPPORT and CONFIG_MISC 
to enable the MISC drivers in the SPL.

JJ

> +
> +config TPL_MISC
> +	bool "Enable Driver Model for Misc drivers in TPL"
> +	depends on TPL_DM
> +	help
> +	  Enable driver model for miscellaneous devices. This class is
> +	  used only for those do not fit other more general classes. A
> +	  set of generic read, write and ioctl methods may be used to
> +	  access the device.
> +
>   config ALTERA_SYSID
>   	bool "Altera Sysid support"
>   	depends on MISC
> @@ -68,6 +86,24 @@ config CROS_EC
>   	  control access to the battery and main PMIC depending on the
>   	  device. You can use the 'crosec' command to access it.
>   
> +config SPL_CROS_EC
> +	bool "Enable Chrome OS EC in SPL"
> +	help
> +	  Enable access to the Chrome OS EC in SPL. This is a separate
> +	  microcontroller typically available on a SPI bus on Chromebooks. It
> +	  provides access to the keyboard, some internal storage and may
> +	  control access to the battery and main PMIC depending on the
> +	  device. You can use the 'crosec' command to access it.
> +
> +config TPL_CROS_EC
> +	bool "Enable Chrome OS EC in TPL"
> +	help
> +	  Enable access to the Chrome OS EC in TPL. This is a separate
> +	  microcontroller typically available on a SPI bus on Chromebooks. It
> +	  provides access to the keyboard, some internal storage and may
> +	  control access to the battery and main PMIC depending on the
> +	  device. You can use the 'crosec' command to access it.
> +
>   config CROS_EC_I2C
>   	bool "Enable Chrome OS EC I2C driver"
>   	depends on CROS_EC
> @@ -86,6 +122,24 @@ config CROS_EC_LPC
>   	  through a legacy port interface, so on x86 machines the main
>   	  function of the EC is power and thermal management.
>   
> +config SPL_CROS_EC_LPC
> +	bool "Enable Chrome OS EC LPC driver in SPL"
> +	depends on CROS_EC
> +	help
> +	  Enable I2C access to the Chrome OS EC. This is used on x86
> +	  Chromebooks such as link and falco. The keyboard is provided
> +	  through a legacy port interface, so on x86 machines the main
> +	  function of the EC is power and thermal management.
> +
> +config TPL_CROS_EC_LPC
> +	bool "Enable Chrome OS EC LPC driver in TPL"
> +	depends on CROS_EC
> +	help
> +	  Enable I2C access to the Chrome OS EC. This is used on x86
> +	  Chromebooks such as link and falco. The keyboard is provided
> +	  through a legacy port interface, so on x86 machines the main
> +	  function of the EC is power and thermal management.
> +
>   config CROS_EC_SANDBOX
>   	bool "Enable Chrome OS EC sandbox driver"
>   	depends on CROS_EC && SANDBOX
> @@ -95,6 +149,24 @@ config CROS_EC_SANDBOX
>   	  EC flash read/write/erase support and a few other things. It is
>   	  enough to perform a Chrome OS verified boot on sandbox.
>   
> +config SPL_CROS_EC_SANDBOX
> +	bool "Enable Chrome OS EC sandbox driver in SPL"
> +	depends on SPL_CROS_EC && SANDBOX
> +	help
> +	  Enable a sandbox emulation of the Chrome OS EC in SPL. This supports
> +	  keyboard (use the -l flag to enable the LCD), verified boot context,
> +	  EC flash read/write/erase support and a few other things. It is
> +	  enough to perform a Chrome OS verified boot on sandbox.
> +
> +config TPL_CROS_EC_SANDBOX
> +	bool "Enable Chrome OS EC sandbox driver in TPL"
> +	depends on TPL_CROS_EC && SANDBOX
> +	help
> +	  Enable a sandbox emulation of the Chrome OS EC in TPL. This supports
> +	  keyboard (use the -l flag to enable the LCD), verified boot context,
> +	  EC flash read/write/erase support and a few other things. It is
> +	  enough to perform a Chrome OS verified boot on sandbox.
> +
>   config CROS_EC_SPI
>   	bool "Enable Chrome OS EC SPI driver"
>   	depends on CROS_EC
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index 302d4415927..6efb8134b14 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -4,11 +4,13 @@
>   # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
>   
>   obj-$(CONFIG_MISC) += misc-uclass.o
> +
> +obj-$(CONFIG_$(SPL_TPL_)CROS_EC) += cros_ec.o
> +obj-$(CONFIG_$(SPL_TPL_)CROS_EC_SANDBOX) += cros_ec_sandbox.o
> +obj-$(CONFIG_$(SPL_TPL_)CROS_EC_LPC) += cros_ec_lpc.o
> +
>   ifndef CONFIG_SPL_BUILD
> -obj-$(CONFIG_CROS_EC) += cros_ec.o
> -obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o
>   obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o
> -obj-$(CONFIG_CROS_EC_SANDBOX) += cros_ec_sandbox.o
>   obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o
>   endif
>   

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (10 preceding siblings ...)
  2018-11-29 17:39 ` sjg at google.com
@ 2018-11-29 17:39 ` sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass sjg at google.com
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

Update the device tree, sandbox i2c driver and tests to use the new
emulation parent to hold emulators.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/sandbox/dts/sandbox.dts       | 25 +++++++----
 arch/sandbox/dts/sandbox_pmic.dtsi | 71 +++++++++++++++---------------
 arch/sandbox/dts/test.dts          | 30 +++++++++----
 drivers/i2c/sandbox_i2c.c          | 20 +--------
 drivers/power/pmic/i2c_pmic_emul.c |  2 +-
 test/dm/i2c.c                      |  2 +-
 test/dm/rtc.c                      |  9 ++--
 7 files changed, 82 insertions(+), 77 deletions(-)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 10/10] rtc: Allow child drivers
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (9 preceding siblings ...)
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 10/10] rtc: Allow child drivers Simon Glass
@ 2018-11-29 17:39 ` sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass sjg at google.com
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

Some RTC chips have child drivers, e.g. to provide access to their
non-volatile RAM. Scan for these when binding.

Signed-off-by: Simon Glass <sjg@chromium.org>

---

Changes in v2:
- Drop patches previously applied
- Add new patches to support the RTC change

 drivers/rtc/rtc-uclass.c | 1 +
 1 file changed, 1 insertion(+)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (11 preceding siblings ...)
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass sjg at google.com
@ 2018-11-29 17:39 ` sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order sjg at google.com
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

Sandbox i2c works using emulation drivers which are currently children of
the i2c device:

	rtc_0: rtc at 43 {
		reg = <0x43>;
		compatible = "sandbox-rtc";
		emul {
			compatible = "sandbox,i2c-rtc";
		};
	};

In this case the emulation device is attached to i2c bus on address 0x43
and provides the Real-Time-Clock (RTC) functionality.

However this is not ideal, since every device on an I2C bus has a child
device. This is only really the case for sandbox, but we want to avoid
special-case code for sandbox.

A better approach seems to be to add a separate node on the bus, an
'emulation parent'. This can be given a bogus address (such as 0xff) and
hides all the emulators away. Then we can use a phandle to point from the
device to the correct emualtor, and only on sandbox. The code to find an
emulator does not interfere with normal i2c operation.

Add a new UCLASS_I2C_EMUL_PARENT uclass which allows finding an emulator
given a bus, and finding a bus given an emulator. This will be used in a
follow-on patch.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/i2c/i2c-emul-uclass.c | 77 +++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h        |  1 +
 include/i2c.h                 | 21 ++++++++++
 3 files changed, 99 insertions(+)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (12 preceding siblings ...)
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass sjg at google.com
@ 2018-11-29 17:39 ` sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions sjg at google.com
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

This is currently at the top in the space for internal use. But this
uclass is used outside driver model and test code. Move it into the
correct alpha order.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 include/dm/uclass-id.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (13 preceding siblings ...)
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order sjg at google.com
@ 2018-11-29 17:39 ` sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle() sjg at google.com
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

Add two functions which can find a child device by uclass or by name.
The first is useful with Multi-Function-Devices (MFDs) to find one of a
particular type. The second is useful when only the name is known.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/core/device.c | 34 ++++++++++++++++++++++++++++++++++
 include/dm/device.h   | 25 +++++++++++++++++++++++++
 test/dm/test-fdt.c    | 27 +++++++++++++++++++++++++++
 3 files changed, 86 insertions(+)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle()
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (14 preceding siblings ...)
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions sjg at google.com
@ 2018-11-29 17:39 ` sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations sjg at google.com
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

This function may be useful to code outside of the code driver-model
implementation. Export it and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/core/uclass.c        |  6 ++----
 include/dm/uclass-internal.h | 17 +++++++++++++++++
 test/dm/test-fdt.c           | 20 ++++++++++++++++++++
 3 files changed, 39 insertions(+), 4 deletions(-)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (15 preceding siblings ...)
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle() sjg at google.com
@ 2018-11-29 17:39 ` sjg at google.com
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations sjg at google.com
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

At present tests are quite slow to run, over a minute on my machine. This
presents a considerable barrier to bisecting for failures.

The slowest tests are the filesystem ones and the buildman --fetch-arch
test. Add a new 'qcheck' target that skips these tests. This reduces test
time down to about 40 second, still too long, but bearable.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 Makefile                             |  6 +++++-
 test/README                          |  6 +++++-
 test/py/tests/test_fs/test_basic.py  |  1 +
 test/py/tests/test_fs/test_ext.py    |  1 +
 test/py/tests/test_fs/test_mkdir.py  |  1 +
 test/py/tests/test_fs/test_unlink.py |  1 +
 test/run                             | 10 ++++++++--
 7 files changed, 22 insertions(+), 4 deletions(-)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output
  2018-11-18 15:14 ` [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output Simon Glass
  2018-11-18 21:17   ` Lukasz Majewski
@ 2018-11-29 17:39   ` sjg at google.com
  1 sibling, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

On Sun, 18 Nov 2018 08:14:28 -0700
Simon Glass <sjg@chromium.org> wrote:

> There is a newline missing from quite a few printf() strings in these
> pmic files. Fix them.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations
  2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
                   ` (16 preceding siblings ...)
  2018-11-29 17:39 ` [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing sjg at google.com
@ 2018-11-29 17:39 ` sjg at google.com
  17 siblings, 0 replies; 25+ messages in thread
From: sjg at google.com @ 2018-11-29 17:39 UTC (permalink / raw)
  To: u-boot

It is sometimes useful to see what memory is being allocated early during
boot. Add logging to support this, using a new LOGC_ALLOC category.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Rebase to master
- Correct definition of log() when logging is disabled

 common/malloc_simple.c | 58 +++++++++++++++++++++++++++---------------
 include/log.h          |  2 +-
 include/malloc.h       |  1 +
 3 files changed, 39 insertions(+), 22 deletions(-)

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL
  2018-11-20 13:49   ` Jean-Jacques Hiblot
@ 2019-01-31  2:57     ` Simon Glass
  2019-01-31  9:38       ` Jean-Jacques Hiblot
  0 siblings, 1 reply; 25+ messages in thread
From: Simon Glass @ 2019-01-31  2:57 UTC (permalink / raw)
  To: u-boot

Hi Jean-Jacques,

On Tue, 20 Nov 2018 at 06:49, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>
> Hi Simon,
>
> On 18/11/2018 16:14, Simon Glass wrote:
> > In some cases it is necessary to read the keyboard in early phases of
> > U-Boot. The cros_ec keyboard is kept in the misc directory. Update the
> > config to allow this.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > Changes in v2:
> > - Leave the misc uclass alone since it stops sandbox_spl working
> >
> >   drivers/misc/Kconfig  | 72 +++++++++++++++++++++++++++++++++++++++++++
> >   drivers/misc/Makefile |  8 +++--
> >   2 files changed, 77 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> > index 48febc47d26..802046cf966 100644
> > --- a/drivers/misc/Kconfig
> > +++ b/drivers/misc/Kconfig
> > @@ -13,6 +13,24 @@ config MISC
> >         set of generic read, write and ioctl methods may be used to
> >         access the device.
> >
> > +config SPL_MISC
> > +     bool "Enable Driver Model for Misc drivers in SPL"
> > +     depends on SPL_DM
> > +     help
> > +       Enable driver model for miscellaneous devices. This class is
> > +       used only for those do not fit other more general classes. A
> > +       set of generic read, write and ioctl methods may be used to
> > +       access the device.
>
> Platforms currently use CONFIG_SPL_DRIVERS_MISC_SUPPORT and CONFIG_MISC
> to enable the MISC drivers in the SPL.

This is a bit confusing but that is not my understanding of the situation.

CONFIG_MISC enables UCLASS_MISC devices. The 'misc' drivers directory
is included always in U-Boot proper. Yes the
CONFIG_SPL_DRIVERS_MISC_SUPPORT option is for SPL only.

But in my case I want an option to enable driver-model MISC devices in
SPL/TPL. Oddly this is orthogonal to whether the drivers/misc
directory itself is included in the build.

Regards,
Simon

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL
  2019-01-31  2:57     ` Simon Glass
@ 2019-01-31  9:38       ` Jean-Jacques Hiblot
  2019-05-22 13:21         ` Simon Glass
  0 siblings, 1 reply; 25+ messages in thread
From: Jean-Jacques Hiblot @ 2019-01-31  9:38 UTC (permalink / raw)
  To: u-boot


On 31/01/2019 03:57, Simon Glass wrote:
> Hi Jean-Jacques,
>
> On Tue, 20 Nov 2018 at 06:49, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>> Hi Simon,
>>
>> On 18/11/2018 16:14, Simon Glass wrote:
>>> In some cases it is necessary to read the keyboard in early phases of
>>> U-Boot. The cros_ec keyboard is kept in the misc directory. Update the
>>> config to allow this.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>> ---
>>>
>>> Changes in v2:
>>> - Leave the misc uclass alone since it stops sandbox_spl working
>>>
>>>    drivers/misc/Kconfig  | 72 +++++++++++++++++++++++++++++++++++++++++++
>>>    drivers/misc/Makefile |  8 +++--
>>>    2 files changed, 77 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
>>> index 48febc47d26..802046cf966 100644
>>> --- a/drivers/misc/Kconfig
>>> +++ b/drivers/misc/Kconfig
>>> @@ -13,6 +13,24 @@ config MISC
>>>          set of generic read, write and ioctl methods may be used to
>>>          access the device.
>>>
>>> +config SPL_MISC
>>> +     bool "Enable Driver Model for Misc drivers in SPL"
>>> +     depends on SPL_DM
>>> +     help
>>> +       Enable driver model for miscellaneous devices. This class is
>>> +       used only for those do not fit other more general classes. A
>>> +       set of generic read, write and ioctl methods may be used to
>>> +       access the device.
>> Platforms currently use CONFIG_SPL_DRIVERS_MISC_SUPPORT and CONFIG_MISC
>> to enable the MISC drivers in the SPL.
> This is a bit confusing but that is not my understanding of the situation.
>
> CONFIG_MISC enables UCLASS_MISC devices. The 'misc' drivers directory
> is included always in U-Boot proper. Yes the
> CONFIG_SPL_DRIVERS_MISC_SUPPORT option is for SPL only.
>
> But in my case I want an option to enable driver-model MISC devices in
> SPL/TPL. Oddly this is orthogonal to whether the drivers/misc
> directory itself is included in the build.

Ok. that makes sense now.


>
> Regards,
> Simon
>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL
  2019-01-31  9:38       ` Jean-Jacques Hiblot
@ 2019-05-22 13:21         ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2019-05-22 13:21 UTC (permalink / raw)
  To: u-boot

On Thu, 31 Jan 2019 at 02:39, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>
>
> On 31/01/2019 03:57, Simon Glass wrote:
> > Hi Jean-Jacques,
> >
> > On Tue, 20 Nov 2018 at 06:49, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
> >> Hi Simon,
> >>
> >> On 18/11/2018 16:14, Simon Glass wrote:
> >>> In some cases it is necessary to read the keyboard in early phases of
> >>> U-Boot. The cros_ec keyboard is kept in the misc directory. Update the
> >>> config to allow this.
> >>>
> >>> Signed-off-by: Simon Glass <sjg@chromium.org>
> >>> ---
> >>>
> >>> Changes in v2:
> >>> - Leave the misc uclass alone since it stops sandbox_spl working
> >>>
> >>>    drivers/misc/Kconfig  | 72 +++++++++++++++++++++++++++++++++++++++++++
> >>>    drivers/misc/Makefile |  8 +++--
> >>>    2 files changed, 77 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> >>> index 48febc47d26..802046cf966 100644
> >>> --- a/drivers/misc/Kconfig
> >>> +++ b/drivers/misc/Kconfig
> >>> @@ -13,6 +13,24 @@ config MISC
> >>>          set of generic read, write and ioctl methods may be used to
> >>>          access the device.
> >>>
> >>> +config SPL_MISC
> >>> +     bool "Enable Driver Model for Misc drivers in SPL"
> >>> +     depends on SPL_DM
> >>> +     help
> >>> +       Enable driver model for miscellaneous devices. This class is
> >>> +       used only for those do not fit other more general classes. A
> >>> +       set of generic read, write and ioctl methods may be used to
> >>> +       access the device.
> >> Platforms currently use CONFIG_SPL_DRIVERS_MISC_SUPPORT and CONFIG_MISC
> >> to enable the MISC drivers in the SPL.
> > This is a bit confusing but that is not my understanding of the situation.
> >
> > CONFIG_MISC enables UCLASS_MISC devices. The 'misc' drivers directory
> > is included always in U-Boot proper. Yes the
> > CONFIG_SPL_DRIVERS_MISC_SUPPORT option is for SPL only.
> >
> > But in my case I want an option to enable driver-model MISC devices in
> > SPL/TPL. Oddly this is orthogonal to whether the drivers/misc
> > directory itself is included in the build.
>
> Ok. that makes sense now.

Applied to u-boot-dm.

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-05-22 13:21 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-18 15:14 [U-Boot] [PATCH v2 00/10] Various fixes and improvements Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL Simon Glass
2018-11-20 13:49   ` Jean-Jacques Hiblot
2019-01-31  2:57     ` Simon Glass
2019-01-31  9:38       ` Jean-Jacques Hiblot
2019-05-22 13:21         ` Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 03/10] power: pmic: Correct debug/error output Simon Glass
2018-11-18 21:17   ` Lukasz Majewski
2018-11-29 17:39   ` sjg at google.com
2018-11-18 15:14 ` [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle() Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass Simon Glass
2018-11-18 15:14 ` [U-Boot] [PATCH v2 10/10] rtc: Allow child drivers Simon Glass
2018-11-29 17:39 ` sjg at google.com
2018-11-29 17:39 ` [U-Boot] [PATCH v2 09/10] dm: sandbox: i2c: Use new emulator parent uclass sjg at google.com
2018-11-29 17:39 ` [U-Boot] [PATCH v2 08/10] dm: sandbox: i2c: Add a new 'emulation parent' uclass sjg at google.com
2018-11-29 17:39 ` [U-Boot] [PATCH v2 07/10] dm: core: Put UCLASS_SIMPLE_BUS in order sjg at google.com
2018-11-29 17:39 ` [U-Boot] [PATCH v2 06/10] dm: core: Add a few more specific child-finding functions sjg at google.com
2018-11-29 17:39 ` [U-Boot] [PATCH v2 05/10] dm: core: Export uclass_find_device_by_phandle() sjg at google.com
2018-11-29 17:39 ` [U-Boot] [PATCH v2 04/10] test: Add a 'make qcheck' target for quicker testing sjg at google.com
2018-11-29 17:39 ` [U-Boot] [PATCH v2 01/10] malloc_simple: Add logging of allocations sjg at google.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.