Merge tag 'dm-pull-10apr20-take2' of git://git.denx.de/u-boot-dm
authorTom Rini <trini@konsulko.com>
Thu, 16 Apr 2020 17:45:03 +0000 (13:45 -0400)
committerTom Rini <trini@konsulko.com>
Thu, 16 Apr 2020 17:45:03 +0000 (13:45 -0400)
Functions for reading indexed values from device tree
Enhancements to 'dm' command
Log test enhancements and syslog driver
DM change to read parent ofdata before children
Minor fixes

1  2 
arch/sandbox/dts/test.dts
include/dm/device.h
include/log.h
include/test/ut.h
test/dm/Makefile

index 5fa951ad4b6e971353ce8765ecad27083b4ce5c6,1973623a992bb7cc301b3da3a6d6695a9bbf8d6f..6803c00f90ac155531f2f5bc7d9f2572fb99ef78
@@@ -93,6 -93,8 +93,8 @@@
                        <&gpio_b 9 0xc 3 2 1>;
                int-value = <1234>;
                uint-value = <(-1234)>;
+               int64-value = /bits/ 64 <0x1111222233334444>;
+               int-array = <5678 9123 4567>;
                interrupts-extended = <&irq 3 0>;
        };
  
                compatible = "denx,u-boot-devres-test";
        };
  
 +      acpi-test {
 +              compatible = "denx,u-boot-acpi-test";
 +      };
 +
        clocks {
                clk_fixed: clk-fixed {
                        compatible = "fixed-clock";
                compatible = "sandbox,pch";
        };
  
-       pci0: pci-controller0 {
+       pci0: pci@0 {
                compatible = "sandbox,pci";
                device_type = "pci";
+               bus-range = <0x00 0xff>;
                #address-cells = <3>;
                #size-cells = <2>;
                ranges = <0x02000000 0 0x10000000 0x10000000 0 0x2000000
                };
        };
  
-       pci1: pci-controller1 {
+       pci1: pci@1 {
                compatible = "sandbox,pci";
                device_type = "pci";
+               bus-range = <0x00 0xff>;
                #address-cells = <3>;
                #size-cells = <2>;
                ranges = <0x02000000 0 0x30000000 0x30000000 0 0x2000
                };
        };
  
-       pci2: pci-controller2 {
+       pci2: pci@2 {
                compatible = "sandbox,pci";
                device_type = "pci";
+               bus-range = <0x00 0xff>;
                #address-cells = <3>;
                #size-cells = <2>;
                ranges = <0x02000000 0 0x50000000 0x50000000 0 0x2000
diff --combined include/dm/device.h
index 35e19d870052da58193bcefa3bab587121c0acd3,17e57bf829c51e04eba1a91c4c6414796068cc27..975eec5d0e19ba02c9220706234a3a3ec12db5d4
@@@ -80,18 -80,21 +80,21 @@@ struct driver_info
   */
  enum {
        /* Normal remove, remove all devices */
-       DM_REMOVE_NORMAL     = 1 << 0,
+       DM_REMOVE_NORMAL        = 1 << 0,
  
        /* Remove devices with active DMA */
-       DM_REMOVE_ACTIVE_DMA = DM_FLAG_ACTIVE_DMA,
+       DM_REMOVE_ACTIVE_DMA    = DM_FLAG_ACTIVE_DMA,
  
        /* Remove devices which need some final OS preparation steps */
-       DM_REMOVE_OS_PREPARE = DM_FLAG_OS_PREPARE,
+       DM_REMOVE_OS_PREPARE    = DM_FLAG_OS_PREPARE,
  
        /* Add more use cases here */
  
        /* Remove devices with any active flag */
-       DM_REMOVE_ACTIVE_ALL = DM_REMOVE_ACTIVE_DMA | DM_REMOVE_OS_PREPARE,
+       DM_REMOVE_ACTIVE_ALL    = DM_REMOVE_ACTIVE_DMA | DM_REMOVE_OS_PREPARE,
+       /* Don't power down any attached power domains */
+       DM_REMOVE_NO_PD         = 1 << 1,
  };
  
  /**
@@@ -245,8 -248,6 +248,8 @@@ struct udevice_id 
   * pointers defined by the driver, to implement driver functions required by
   * the uclass.
   * @flags: driver flags - see DM_FLAGS_...
 + * @acpi_ops: Advanced Configuration and Power Interface (ACPI) operations,
 + * allowing the device to add things to the ACPI tables passed to Linux
   */
  struct driver {
        char *name;
        int per_child_platdata_auto_alloc_size;
        const void *ops;        /* driver-specific operations */
        uint32_t flags;
 +#if CONFIG_IS_ENABLED(ACPIGEN)
 +      struct acpi_ops *acpi_ops;
 +#endif
  };
  
  /* Declare a new U-Boot driver */
diff --combined include/log.h
index fbcbd42fb4b452c79dcf76de1f37a68561a9b189,04538760012c8bb87bf8c25591a830454cc1f43e..cf32351134375bc4fd86d126b57f8d12a5dd2983
@@@ -51,8 -51,6 +51,8 @@@ enum log_category_t 
        LOGC_SANDBOX,   /* Related to the sandbox board */
        LOGC_BLOBLIST,  /* Bloblist */
        LOGC_DEVRES,    /* Device resources (devres_... functions) */
 +      /* Advanced Configuration and Power Interface (ACPI) */
 +      LOGC_ACPI,
  
        LOGC_COUNT,     /* Number of log categories */
        LOGC_END,       /* Sentinel value for a list of log categories */
@@@ -117,11 -115,11 +117,11 @@@ static inline int _log_nop(enum log_cat
  #define log_io(_fmt...)               log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
  #else
  #define _LOG_MAX_LEVEL LOGL_INFO
- #define log_err(_fmt...)      log_nop(LOG_CATEGORY, LOGL_ERR, ##_fmt)
- #define log_warning(_fmt...)  log_nop(LOG_CATEGORY, LOGL_WARNING, ##_fmt)
- #define log_notice(_fmt...)   log_nop(LOG_CATEGORY, LOGL_NOTICE, ##_fmt)
- #define log_info(_fmt...)     log_nop(LOG_CATEGORY, LOGL_INFO, ##_fmt)
- #define log_debug(_fmt...)    log_nop(LOG_CATEGORY, LOGL_DEBUG, ##_fmt)
+ #define log_err(_fmt, ...)    printf(_fmt, ##__VA_ARGS__)
+ #define log_warning(_fmt, ...)        printf(_fmt, ##__VA_ARGS__)
+ #define log_notice(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
+ #define log_info(_fmt, ...)   printf(_fmt, ##__VA_ARGS__)
+ #define log_debug(_fmt, ...)  debug(_fmt, ##__VA_ARGS__)
  #define log_content(_fmt...)  log_nop(LOG_CATEGORY, \
                                        LOGL_DEBUG_CONTENT, ##_fmt)
  #define log_io(_fmt...)               log_nop(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
diff --combined include/test/ut.h
index 39d15953ed3a70c19beb902bbd81b7617c11c13e,ab861588a84a097b4b00b395beb6da09620763e3..b05d719ed0d9dc3491717a92edac1efe9a9909b0
@@@ -8,7 -8,6 +8,7 @@@
  #ifndef __TEST_UT_H
  #define __TEST_UT_H
  
 +#include <hexdump.h>
  #include <linux/err.h>
  
  struct unit_test_state;
@@@ -105,6 -104,22 +105,22 @@@ int ut_check_console_dump(struct unit_t
        }                                                               \
  }
  
+ /* Assert that two 64 int expressions are equal */
+ #define ut_asserteq_64(expr1, expr2) {                                        \
+       u64 _val1 = (expr1), _val2 = (expr2);                           \
+                                                                       \
+       if (_val1 != _val2) {                                           \
+               ut_failf(uts, __FILE__, __LINE__, __func__,             \
+                        #expr1 " == " #expr2,                          \
+                        "Expected %#llx (%lld), got %#llx (%lld)",     \
+                        (unsigned long long)_val1,                     \
+                        (unsigned long long)_val1,                     \
+                        (unsigned long long)_val2,                     \
+                        (unsigned long long)_val2);                    \
+               return CMD_RET_FAILURE;                                 \
+       }                                                               \
+ }
  /* Assert that two string expressions are equal */
  #define ut_asserteq_str(expr1, expr2) {                                       \
        const char *_val1 = (expr1), *_val2 = (expr2);                  \
diff --combined test/dm/Makefile
index 3daf8a544ea018473828e02739d70a2262dd8367,53caa29fbbacc527f4c5770429c5d4ea7aa3e80b..f55874c0f2b28cf1c0b24c8d4508c290e5a30529
@@@ -13,7 -13,6 +13,7 @@@ obj-$(CONFIG_UT_DM) += test-uclass.
  # subsystem you must add sandbox tests here.
  obj-$(CONFIG_UT_DM) += core.o
  ifneq ($(CONFIG_SANDBOX),)
 +obj-$(CONFIG_ACPIGEN) += acpi.o
  obj-$(CONFIG_SOUND) += audio.o
  obj-$(CONFIG_BLK) += blk.o
  obj-$(CONFIG_BOARD) += board.o
@@@ -32,6 -31,7 +32,7 @@@ obj-$(CONFIG_LED) += led.
  obj-$(CONFIG_DM_MAILBOX) += mailbox.o
  obj-$(CONFIG_DM_MMC) += mmc.o
  obj-y += ofnode.o
+ obj-y += fdtdec.o
  obj-$(CONFIG_OSD) += osd.o
  obj-$(CONFIG_DM_VIDEO) += panel.o
  obj-$(CONFIG_DM_PCI) += pci.o