]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-net
authorTom Rini <trini@konsulko.com>
Thu, 13 Oct 2016 17:38:49 +0000 (13:38 -0400)
committerTom Rini <trini@konsulko.com>
Thu, 13 Oct 2016 17:38:49 +0000 (13:38 -0400)
103 files changed:
arch/sandbox/cpu/os.c
arch/sandbox/include/asm/io.h
cmd/Kconfig
cmd/Makefile
cmd/cros_ec.c [new file with mode: 0644]
configs/am335x_boneblack_vboot_defconfig
configs/am335x_evm_defconfig
configs/am43xx_evm_defconfig
configs/am43xx_evm_usbhost_boot_defconfig
configs/am43xx_hs_evm_defconfig
configs/am57xx_evm_defconfig
configs/am57xx_hs_evm_defconfig
configs/apalis_t30_defconfig
configs/beaver_defconfig
configs/cardhu_defconfig
configs/cei-tk1-som_defconfig
configs/colibri_t20_defconfig
configs/colibri_t30_defconfig
configs/dalmore_defconfig
configs/dra7xx_evm_defconfig
configs/dra7xx_hs_evm_defconfig
configs/e2220-1170_defconfig
configs/harmony_defconfig
configs/jetson-tk1_defconfig
configs/k2g_evm_defconfig
configs/medcom-wide_defconfig
configs/mx6ull_14x14_evk_defconfig
configs/nyan-big_defconfig
configs/p2371-0000_defconfig
configs/p2371-2180_defconfig
configs/p2571_defconfig
configs/p2771-0000-000_defconfig
configs/p2771-0000-500_defconfig
configs/paz00_defconfig
configs/pic32mzdask_defconfig
configs/plutux_defconfig
configs/sandbox_noblk_defconfig
configs/seaboard_defconfig
configs/tec-ng_defconfig
configs/tec_defconfig
configs/trimslice_defconfig
configs/venice2_defconfig
configs/ventana_defconfig
configs/whistler_defconfig
drivers/block/Kconfig
drivers/misc/cros_ec.c
drivers/mmc/Kconfig
drivers/mmc/atmel_sdhci.c
drivers/mmc/bcm2835_sdhci.c
drivers/mmc/dw_mmc.c
drivers/mmc/exynos_dw_mmc.c
drivers/mmc/ftsdc021_sdhci.c
drivers/mmc/kona_sdhci.c
drivers/mmc/mmc-uclass.c
drivers/mmc/mmc_private.h
drivers/mmc/mmc_write.c
drivers/mmc/msm_sdhci.c
drivers/mmc/mv_sdhci.c
drivers/mmc/pci_mmc.c
drivers/mmc/rockchip_dw_mmc.c
drivers/mmc/s5p_sdhci.c
drivers/mmc/sdhci.c
drivers/mmc/socfpga_dw_mmc.c
drivers/mmc/spear_sdhci.c
drivers/mmc/zynq_sdhci.c
drivers/power/pmic/Kconfig
drivers/power/pmic/Makefile
drivers/power/pmic/lp873x.c [new file with mode: 0644]
drivers/power/pmic/palmas.c [new file with mode: 0644]
drivers/power/regulator/Kconfig
drivers/power/regulator/Makefile
drivers/power/regulator/gpio-regulator.c [new file with mode: 0644]
drivers/power/regulator/lp873x_regulator.c [new file with mode: 0644]
drivers/power/regulator/palmas_regulator.c [new file with mode: 0644]
fs/sandbox/sandboxfs.c
include/cros_ec.h
include/dwmmc.h
include/os.h
include/power/lp873x.h [new file with mode: 0644]
include/power/palmas.h [new file with mode: 0644]
include/power/regulator.h
tools/buildman/README
tools/buildman/builder.py
tools/buildman/builderthread.py
tools/buildman/buildman.py
tools/buildman/test.py
tools/buildman/toolchain.py
tools/dtoc/dtoc.py
tools/dtoc/fdt_fallback.py
tools/dtoc/fdt_normal.py
tools/dtoc/fdt_select.py
tools/dtoc/fdt_util.py
tools/patman/checkpatch.py
tools/patman/command.py
tools/patman/cros_subprocess.py
tools/patman/get_maintainer.py
tools/patman/gitutil.py
tools/patman/patchstream.py
tools/patman/patman.py
tools/patman/series.py
tools/patman/settings.py
tools/patman/terminal.py
tools/patman/test.py

index 2d63dd88f121e0cbcb4effa498c56530aa6223fb..35ea00ce3ca0699d478b206ed50a9411665ef495 100644 (file)
@@ -313,21 +313,23 @@ void os_dirent_free(struct os_dirent_node *node)
 
 int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
 {
-       struct dirent entry, *result;
+       struct dirent *entry;
        struct os_dirent_node *head, *node, *next;
        struct stat buf;
        DIR *dir;
        int ret;
        char *fname;
        int len;
+       int dirlen;
 
        *headp = NULL;
        dir = opendir(dirname);
        if (!dir)
                return -1;
 
-       /* Create a buffer for the maximum filename length */
-       len = sizeof(entry.d_name) + strlen(dirname) + 2;
+       /* Create a buffer upfront, with typically sufficient size */
+       dirlen = strlen(dirname) + 2;
+       len = dirlen + 256;
        fname = malloc(len);
        if (!fname) {
                ret = -ENOMEM;
@@ -335,18 +337,26 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
        }
 
        for (node = head = NULL;; node = next) {
-               ret = readdir_r(dir, &entry, &result);
-               if (ret || !result)
+               errno = 0;
+               entry = readdir(dir);
+               if (!entry) {
+                       ret = errno;
                        break;
-               next = malloc(sizeof(*node) + strlen(entry.d_name) + 1);
-               if (!next) {
+               }
+               next = malloc(sizeof(*node) + strlen(entry->d_name) + 1);
+               if (dirlen + strlen(entry->d_name) > len) {
+                       len = dirlen + strlen(entry->d_name);
+                       fname = realloc(fname, len);
+               }
+               if (!next || !fname) {
+                       free(next);
                        os_dirent_free(head);
                        ret = -ENOMEM;
                        goto done;
                }
                next->next = NULL;
-               strcpy(next->name, entry.d_name);
-               switch (entry.d_type) {
+               strcpy(next->name, entry->d_name);
+               switch (entry->d_type) {
                case DT_REG:
                        next->type = OS_FILET_REG;
                        break;
@@ -356,6 +366,8 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
                case DT_LNK:
                        next->type = OS_FILET_LNK;
                        break;
+               default:
+                       next->type = OS_FILET_UNKNOWN;
                }
                next->size = 0;
                snprintf(fname, len, "%s/%s", dirname, next->name);
@@ -363,8 +375,8 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
                        next->size = buf.st_size;
                if (node)
                        node->next = next;
-               if (!head)
-                       head = node;
+               else
+                       head = next;
        }
        *headp = head;
 
index 69196329d76a5924bb1969c4917910c000d17a29..a6856356df199f75bd62c029c5147a8b067e5db5 100644 (file)
@@ -40,12 +40,12 @@ static inline void unmap_sysmem(const void *vaddr)
 phys_addr_t map_to_sysmem(const void *ptr);
 
 /* Define nops for sandbox I/O access */
-#define readb(addr) 0
-#define readw(addr) 0
-#define readl(addr) 0
-#define writeb(v, addr)
-#define writew(v, addr)
-#define writel(v, addr)
+#define readb(addr) ((void)addr, 0)
+#define readw(addr) ((void)addr, 0)
+#define readl(addr) ((void)addr, 0)
+#define writeb(v, addr) ((void)addr)
+#define writew(v, addr) ((void)addr)
+#define writel(v, addr) ((void)addr)
 
 /* I/O access functions */
 int inl(unsigned int addr);
index 86554ea36229098581f0c5dd22a40e9ea8090cf3..e339d8638aa5a4a4881f98b7c8bbeb9d4b7530df 100644 (file)
@@ -677,6 +677,19 @@ config CMD_TPM_TEST
 
 endmenu
 
+menu "Firmware commands"
+config CMD_CROS_EC
+       bool "Enable crosec command"
+       depends on CROS_EC
+       default y
+       help
+         Enable command-line access to the Chrome OS EC (Embedded
+         Controller). This provides the 'crosec' command which has
+         a number of sub-commands for performing EC tasks such as
+         updating its flash, accessing a small saved context area
+         and talking to the I2C bus behind the EC (if there is one).
+endmenu
+
 menu "Filesystem commands"
 config CMD_EXT2
        bool "ext2 command support"
index 81b98ee0d751005dc376534837596ee2206beefa..9c9a9d112b0db745fd798e880a8e6559fbcd5148 100644 (file)
@@ -128,6 +128,7 @@ obj-$(CONFIG_CMD_TRACE) += trace.o
 obj-$(CONFIG_HUSH_PARSER) += test.o
 obj-$(CONFIG_CMD_TPM) += tpm.o
 obj-$(CONFIG_CMD_TPM_TEST) += tpm_test.o
+obj-$(CONFIG_CMD_CROS_EC) += cros_ec.o
 obj-$(CONFIG_CMD_TSI148) += tsi148.o
 obj-$(CONFIG_CMD_UBI) += ubi.o
 obj-$(CONFIG_CMD_UBIFS) += ubifs.o
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
new file mode 100644 (file)
index 0000000..abf11f0
--- /dev/null
@@ -0,0 +1,365 @@
+/*
+ * Chromium OS cros_ec driver
+ *
+ * Copyright (c) 2016 The Chromium OS Authors.
+ * Copyright (c) 2016 National Instruments Corp
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <command.h>
+#include <cros_ec.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <dm/uclass-internal.h>
+
+/* Note: depends on enum ec_current_image */
+static const char * const ec_current_image_name[] = {"unknown", "RO", "RW"};
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/**
+ * Perform a flash read or write command
+ *
+ * @param dev          CROS-EC device to read/write
+ * @param is_write     1 do to a write, 0 to do a read
+ * @param argc         Number of arguments
+ * @param argv         Arguments (2 is region, 3 is address)
+ * @return 0 for ok, 1 for a usage error or -ve for ec command error
+ *     (negative EC_RES_...)
+ */
+static int do_read_write(struct cros_ec_dev *dev, int is_write, int argc,
+                        char * const argv[])
+{
+       uint32_t offset, size = -1U, region_size;
+       unsigned long addr;
+       char *endp;
+       int region;
+       int ret;
+
+       region = cros_ec_decode_region(argc - 2, argv + 2);
+       if (region == -1)
+               return 1;
+       if (argc < 4)
+               return 1;
+       addr = simple_strtoul(argv[3], &endp, 16);
+       if (*argv[3] == 0 || *endp != 0)
+               return 1;
+       if (argc > 4) {
+               size = simple_strtoul(argv[4], &endp, 16);
+               if (*argv[4] == 0 || *endp != 0)
+                       return 1;
+       }
+
+       ret = cros_ec_flash_offset(dev, region, &offset, &region_size);
+       if (ret) {
+               debug("%s: Could not read region info\n", __func__);
+               return ret;
+       }
+       if (size == -1U)
+               size = region_size;
+
+       ret = is_write ?
+               cros_ec_flash_write(dev, (uint8_t *)addr, offset, size) :
+               cros_ec_flash_read(dev, (uint8_t *)addr, offset, size);
+       if (ret) {
+               debug("%s: Could not %s region\n", __func__,
+                     is_write ? "write" : "read");
+               return ret;
+       }
+
+       return 0;
+}
+
+static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       struct cros_ec_dev *dev;
+       struct udevice *udev;
+       const char *cmd;
+       int ret = 0;
+
+       if (argc < 2)
+               return CMD_RET_USAGE;
+
+       cmd = argv[1];
+       if (0 == strcmp("init", cmd)) {
+               /* Remove any existing device */
+               ret = uclass_find_device(UCLASS_CROS_EC, 0, &udev);
+               if (!ret)
+                       device_remove(udev);
+               ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
+               if (ret) {
+                       printf("Could not init cros_ec device (err %d)\n", ret);
+                       return 1;
+               }
+               return 0;
+       }
+
+       ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
+       if (ret) {
+               printf("Cannot get cros-ec device (err=%d)\n", ret);
+               return 1;
+       }
+       dev = dev_get_uclass_priv(udev);
+       if (0 == strcmp("id", cmd)) {
+               char id[MSG_BYTES];
+
+               if (cros_ec_read_id(dev, id, sizeof(id))) {
+                       debug("%s: Could not read KBC ID\n", __func__);
+                       return 1;
+               }
+               printf("%s\n", id);
+       } else if (0 == strcmp("info", cmd)) {
+               struct ec_response_mkbp_info info;
+
+               if (cros_ec_info(dev, &info)) {
+                       debug("%s: Could not read KBC info\n", __func__);
+                       return 1;
+               }
+               printf("rows     = %u\n", info.rows);
+               printf("cols     = %u\n", info.cols);
+               printf("switches = %#x\n", info.switches);
+       } else if (0 == strcmp("curimage", cmd)) {
+               enum ec_current_image image;
+
+               if (cros_ec_read_current_image(dev, &image)) {
+                       debug("%s: Could not read KBC image\n", __func__);
+                       return 1;
+               }
+               printf("%d\n", image);
+       } else if (0 == strcmp("hash", cmd)) {
+               struct ec_response_vboot_hash hash;
+               int i;
+
+               if (cros_ec_read_hash(dev, &hash)) {
+                       debug("%s: Could not read KBC hash\n", __func__);
+                       return 1;
+               }
+
+               if (hash.hash_type == EC_VBOOT_HASH_TYPE_SHA256)
+                       printf("type:    SHA-256\n");
+               else
+                       printf("type:    %d\n", hash.hash_type);
+
+               printf("offset:  0x%08x\n", hash.offset);
+               printf("size:    0x%08x\n", hash.size);
+
+               printf("digest:  ");
+               for (i = 0; i < hash.digest_size; i++)
+                       printf("%02x", hash.hash_digest[i]);
+               printf("\n");
+       } else if (0 == strcmp("reboot", cmd)) {
+               int region;
+               enum ec_reboot_cmd cmd;
+
+               if (argc >= 3 && !strcmp(argv[2], "cold")) {
+                       cmd = EC_REBOOT_COLD;
+               } else {
+                       region = cros_ec_decode_region(argc - 2, argv + 2);
+                       if (region == EC_FLASH_REGION_RO)
+                               cmd = EC_REBOOT_JUMP_RO;
+                       else if (region == EC_FLASH_REGION_RW)
+                               cmd = EC_REBOOT_JUMP_RW;
+                       else
+                               return CMD_RET_USAGE;
+               }
+
+               if (cros_ec_reboot(dev, cmd, 0)) {
+                       debug("%s: Could not reboot KBC\n", __func__);
+                       return 1;
+               }
+       } else if (0 == strcmp("events", cmd)) {
+               uint32_t events;
+
+               if (cros_ec_get_host_events(dev, &events)) {
+                       debug("%s: Could not read host events\n", __func__);
+                       return 1;
+               }
+               printf("0x%08x\n", events);
+       } else if (0 == strcmp("clrevents", cmd)) {
+               uint32_t events = 0x7fffffff;
+
+               if (argc >= 3)
+                       events = simple_strtol(argv[2], NULL, 0);
+
+               if (cros_ec_clear_host_events(dev, events)) {
+                       debug("%s: Could not clear host events\n", __func__);
+                       return 1;
+               }
+       } else if (0 == strcmp("read", cmd)) {
+               ret = do_read_write(dev, 0, argc, argv);
+               if (ret > 0)
+                       return CMD_RET_USAGE;
+       } else if (0 == strcmp("write", cmd)) {
+               ret = do_read_write(dev, 1, argc, argv);
+               if (ret > 0)
+                       return CMD_RET_USAGE;
+       } else if (0 == strcmp("erase", cmd)) {
+               int region = cros_ec_decode_region(argc - 2, argv + 2);
+               uint32_t offset, size;
+
+               if (region == -1)
+                       return CMD_RET_USAGE;
+               if (cros_ec_flash_offset(dev, region, &offset, &size)) {
+                       debug("%s: Could not read region info\n", __func__);
+                       ret = -1;
+               } else {
+                       ret = cros_ec_flash_erase(dev, offset, size);
+                       if (ret) {
+                               debug("%s: Could not erase region\n",
+                                     __func__);
+                       }
+               }
+       } else if (0 == strcmp("regioninfo", cmd)) {
+               int region = cros_ec_decode_region(argc - 2, argv + 2);
+               uint32_t offset, size;
+
+               if (region == -1)
+                       return CMD_RET_USAGE;
+               ret = cros_ec_flash_offset(dev, region, &offset, &size);
+               if (ret) {
+                       debug("%s: Could not read region info\n", __func__);
+               } else {
+                       printf("Region: %s\n", region == EC_FLASH_REGION_RO ?
+                                       "RO" : "RW");
+                       printf("Offset: %x\n", offset);
+                       printf("Size:   %x\n", size);
+               }
+       } else if (0 == strcmp("flashinfo", cmd)) {
+               struct ec_response_flash_info p;
+
+               ret = cros_ec_read_flashinfo(dev, &p);
+               if (!ret) {
+                       printf("Flash size:         %u\n", p.flash_size);
+                       printf("Write block size:   %u\n", p.write_block_size);
+                       printf("Erase block size:   %u\n", p.erase_block_size);
+               }
+       } else if (0 == strcmp("vbnvcontext", cmd)) {
+               uint8_t block[EC_VBNV_BLOCK_SIZE];
+               char buf[3];
+               int i, len;
+               unsigned long result;
+
+               if (argc <= 2) {
+                       ret = cros_ec_read_vbnvcontext(dev, block);
+                       if (!ret) {
+                               printf("vbnv_block: ");
+                               for (i = 0; i < EC_VBNV_BLOCK_SIZE; i++)
+                                       printf("%02x", block[i]);
+                               putc('\n');
+                       }
+               } else {
+                       /*
+                        * TODO(clchiou): Move this to a utility function as
+                        * cmd_spi might want to call it.
+                        */
+                       memset(block, 0, EC_VBNV_BLOCK_SIZE);
+                       len = strlen(argv[2]);
+                       buf[2] = '\0';
+                       for (i = 0; i < EC_VBNV_BLOCK_SIZE; i++) {
+                               if (i * 2 >= len)
+                                       break;
+                               buf[0] = argv[2][i * 2];
+                               if (i * 2 + 1 >= len)
+                                       buf[1] = '0';
+                               else
+                                       buf[1] = argv[2][i * 2 + 1];
+                               strict_strtoul(buf, 16, &result);
+                               block[i] = result;
+                       }
+                       ret = cros_ec_write_vbnvcontext(dev, block);
+               }
+               if (ret) {
+                       debug("%s: Could not %s VbNvContext\n", __func__,
+                             argc <= 2 ?  "read" : "write");
+               }
+       } else if (0 == strcmp("test", cmd)) {
+               int result = cros_ec_test(dev);
+
+               if (result)
+                       printf("Test failed with error %d\n", result);
+               else
+                       puts("Test passed\n");
+       } else if (0 == strcmp("version", cmd)) {
+               struct ec_response_get_version *p;
+               char *build_string;
+
+               ret = cros_ec_read_version(dev, &p);
+               if (!ret) {
+                       /* Print versions */
+                       printf("RO version:    %1.*s\n",
+                              (int)sizeof(p->version_string_ro),
+                              p->version_string_ro);
+                       printf("RW version:    %1.*s\n",
+                              (int)sizeof(p->version_string_rw),
+                              p->version_string_rw);
+                       printf("Firmware copy: %s\n",
+                              (p->current_image <
+                              ARRAY_SIZE(ec_current_image_name) ?
+                              ec_current_image_name[p->current_image] :
+                              "?"));
+                       ret = cros_ec_read_build_info(dev, &build_string);
+                       if (!ret)
+                               printf("Build info:    %s\n", build_string);
+               }
+       } else if (0 == strcmp("ldo", cmd)) {
+               uint8_t index, state;
+               char *endp;
+
+               if (argc < 3)
+                       return CMD_RET_USAGE;
+               index = simple_strtoul(argv[2], &endp, 10);
+               if (*argv[2] == 0 || *endp != 0)
+                       return CMD_RET_USAGE;
+               if (argc > 3) {
+                       state = simple_strtoul(argv[3], &endp, 10);
+                       if (*argv[3] == 0 || *endp != 0)
+                               return CMD_RET_USAGE;
+                       ret = cros_ec_set_ldo(udev, index, state);
+               } else {
+                       ret = cros_ec_get_ldo(udev, index, &state);
+                       if (!ret) {
+                               printf("LDO%d: %s\n", index,
+                                      state == EC_LDO_STATE_ON ?
+                                      "on" : "off");
+                       }
+               }
+
+               if (ret) {
+                       debug("%s: Could not access LDO%d\n", __func__, index);
+                       return ret;
+               }
+       } else {
+               return CMD_RET_USAGE;
+       }
+
+       if (ret < 0) {
+               printf("Error: CROS-EC command failed (error %d)\n", ret);
+               ret = 1;
+       }
+
+       return ret;
+}
+
+U_BOOT_CMD(
+       crosec, 6,      1,      do_cros_ec,
+       "CROS-EC utility command",
+       "init                Re-init CROS-EC (done on startup automatically)\n"
+       "crosec id                  Read CROS-EC ID\n"
+       "crosec info                Read CROS-EC info\n"
+       "crosec curimage            Read CROS-EC current image\n"
+       "crosec hash                Read CROS-EC hash\n"
+       "crosec reboot [rw | ro | cold]  Reboot CROS-EC\n"
+       "crosec events              Read CROS-EC host events\n"
+       "crosec clrevents [mask]    Clear CROS-EC host events\n"
+       "crosec regioninfo <ro|rw>  Read image info\n"
+       "crosec flashinfo           Read flash info\n"
+       "crosec erase <ro|rw>       Erase EC image\n"
+       "crosec read <ro|rw> <addr> [<size>]   Read EC image\n"
+       "crosec write <ro|rw> <addr> [<size>]  Write EC image\n"
+       "crosec vbnvcontext [hexstring]        Read [write] VbNvContext from EC\n"
+       "crosec ldo <idx> [<state>] Switch/Read LDO state\n"
+       "crosec test                run tests on cros_ec\n"
+       "crosec version             Read CROS-EC version"
+);
index e0110d1e50f8a4dc4a69d850446a22c800571b06..c6ef65072a693e9dae34edaffa543d1ff257f6b3 100644 (file)
@@ -38,10 +38,12 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
index a2cfef37dac6ed3e70dc4089ce45b6cde4cdb3b2..3136957aec04dec6a55f5c5bd65a3b43674340a3 100644 (file)
@@ -34,11 +34,13 @@ CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="am335x-evm am335x-bone am335x-boneblack am335x-evmsk am335x-bonegreen am335x-icev2"
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_NAND=y
 CONFIG_DFU_RAM=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
index 64e48e9604dee24e3ca8b34f49e66c89e104db4f..304743d0e952e416a38ed942a47735fc6b5ec5a7 100644 (file)
@@ -35,12 +35,14 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm"
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_MACRONIX=y
index 14d874f2632a3e2d20f5cfb10f26733b8f3a4828..f3853717a37c6aa6bc208cdc92e07cb75f4719da 100644 (file)
@@ -38,11 +38,13 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm"
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_DM_SERIAL=y
index 6c5b4096822deec0e036d48a6c8e1ff2d38e1466..ad7c842a954eb313d1b5bb0084e2bde1b31f53af 100644 (file)
@@ -38,12 +38,14 @@ CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_DM_ETH=y
index 15c3389067c1132b58b062c72136035dd8e27634..af54ebefec07e4158405fb9c0ac2e075cfeb95df 100644 (file)
@@ -29,6 +29,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
@@ -37,13 +38,19 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="am57xx-beagle-x15 am572x-idk"
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_PALMAS=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PALMAS=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
index 192997aa51dc4fe25d72cbb22685bc396def23fe..a80e882317b02815b59aef908f7a4f65ae1d9af4 100644 (file)
@@ -38,9 +38,11 @@ CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
index a22e6b659322a5e0c6912de142a387022f29534f..ec33397cf5c21d359f86966c9f989a5c7fddd8b6 100644 (file)
@@ -27,8 +27,10 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_E1000=y
 CONFIG_PCI_TEGRA=y
 CONFIG_SYS_NS16550=y
index 503b8d14ae590067ca4b414a4162936522ed331d..6758c5677d8e0af0045dd71063f3145264b102a5 100644 (file)
@@ -30,9 +30,11 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_RTL8169=y
index 2d361c35e7fb0da0d997e650387acdb91a561090..44955fa508f648cca72f50e22280b42731ef1cfb 100644 (file)
@@ -28,6 +28,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_RTL8169=y
index fb7e2af3095f185ef3de8aec618287bb838c2a49..cc162f9bcc09feb7ca1ea39fbad968bcb9686ecf 100644 (file)
@@ -30,9 +30,11 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_RTL8169=y
index 2745d8ba09e12e7891797b7f6038197da6fe5023..d070a27110e54c52e64f0727033b8fe26697e632 100644 (file)
@@ -31,8 +31,10 @@ CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_UBI=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
index e9eabed60c508c9ef3f5a67a5451b0d6f85cf271..31275d0c0013e94fac2de15477559f8adba13772 100644 (file)
@@ -27,8 +27,10 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
index 2855af56d0b77b58d8a58b72758b93931fff86fd..1de5d4a3a97491e311cd684f99c3be53388fa97d 100644 (file)
@@ -30,9 +30,11 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
index 14ecc248c37b0585698e8110f2a2110ca531b082..c883380d4f7dd1c42113e638cd3a90e443fc99d9 100644 (file)
@@ -47,6 +47,7 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc"
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
@@ -54,13 +55,17 @@ CONFIG_DM_GPIO=y
 CONFIG_PCF8575_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_DM_ETH=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_PALMAS=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_PALMAS=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
index a18fd145aaf6558aade3c88102178d76d6a108fb..1d7838a81038817f849e3d36afc76c18a39cd062 100644 (file)
@@ -50,6 +50,7 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="dra7-evm dra72-evm"
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
@@ -57,6 +58,7 @@ CONFIG_DM_GPIO=y
 CONFIG_PCF8575_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
index 7d0cb68d131023be3f9df97b389afe9a40de98e1..9a4c5566c3d58bde6c8a422d501248e066133caf 100644 (file)
@@ -27,9 +27,11 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
index 4fbca2811740333f7f069f997591f8890ae3801f..e1691f6e5ecf1b944b1800aeb455728b36e5ac0a 100644 (file)
@@ -27,6 +27,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
index af913ac89371cebb99267afb79986a7413bbe7e2..6c284a1efffc4a5d52e3f8e51f1b684b11e180ad 100644 (file)
@@ -30,9 +30,11 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_RTL8169=y
index 13b91cd638bb8dad8ab464c9760bf2005b0e4f2e..3e5630b5113ce0201bde698a82519631b0346845 100644 (file)
@@ -35,7 +35,9 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
+# CONFIG_BLK is not set
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
index 24cace6f3daa6dd5100cb4fa891969c721a27c4a..fc19b5fc9dc1d5a6a766b6192371219651c93940 100644 (file)
@@ -28,6 +28,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
index a106b5d9a1e377e71c10f85034341ef3a64a30f6..58de479b63ad3ad66bab4359714b27b7e90f09ef 100644 (file)
@@ -1,7 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_TARGET_MX6ULL_14X14_EVK=y
-CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ull-14x14-evk"
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ullevk/imximage.cfg"
 CONFIG_BOOTDELAY=3
@@ -21,9 +20,12 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
+# CONFIG_BLK is not set
+CONFIG_DM_GPIO=y
 CONFIG_DM_74X164=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_REGULATOR=y
index b1f9993d5d8092f3148d54d01c7d9ea82a173657..6113162d42f4ae77e0f156609af69e8cc571887f 100644 (file)
@@ -36,6 +36,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
@@ -43,6 +44,7 @@ CONFIG_CROS_EC_KEYB=y
 CONFIG_CMD_CROS_EC=y
 CONFIG_CROS_EC=y
 CONFIG_CROS_EC_SPI=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_PMIC=y
index 69fc1ba778f2927a83c5441e39e82a90de57cb19..db2b6b148b672f246d8b815d44a2812321240858 100644 (file)
@@ -28,9 +28,11 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
index 6ccd7a37e359d939f8c1ef1a97a21ddbb9035ada..1c88af91f87b2b15f37e1db4a61f3a79a4b40ceb 100644 (file)
@@ -28,9 +28,11 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_RTL8169=y
index 1fd464964f4fb007c2e322c3db3ea61d1f499859..1375b527fa489bd7dffaad3f3981cd8c1ebd0d45 100644 (file)
@@ -28,9 +28,11 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
index 4c4606a71ae73f31c0a6951f2de5113d5b068f54..5748f94d071024c23ef6fbc084e85307aee266e0 100644 (file)
@@ -25,7 +25,9 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+# CONFIG_BLK is not set
 CONFIG_TEGRA186_BPMP_I2C=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_E1000=y
 CONFIG_RTL8169=y
 CONFIG_PCI_TEGRA=y
index b32df1cb0cf75eca6a7086244595d4baf7e8c863..28160c27ff5de68d6e7f2222bef964c4633dd4e8 100644 (file)
@@ -25,7 +25,9 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+# CONFIG_BLK is not set
 CONFIG_TEGRA186_BPMP_I2C=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_E1000=y
 CONFIG_RTL8169=y
 CONFIG_PCI_TEGRA=y
index b86f76c623278d8785c8d566e6774f50b9a0882b..815cf4ce46631628aa0f232d27dccb5e84448e94 100644 (file)
@@ -27,6 +27,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
index 4e986bb73abb52c98163052b34334f2650c8a2f5..050c30561985d897c73e8bcd3043bc660f9ef158 100644 (file)
@@ -45,3 +45,4 @@ CONFIG_USB_MUSB_PIC32=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
+# CONFIG_BLK is not set
index b1997fe1dfe8a4111a8894d2de247ff6f7af1ae2..3885adb14635478426b13e7fafda42c66e8e1ce4 100644 (file)
@@ -26,6 +26,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
index 85610ed638bb14697b35c6fca2e6f38b5bb5c000..bc5793fe9fc245dd195f9fcec4f3811440eaacea 100644 (file)
@@ -68,6 +68,7 @@ CONFIG_DEVRES=y
 CONFIG_DEBUG_DEVRES=y
 CONFIG_ADC=y
 CONFIG_ADC_SANDBOX=y
+# CONFIG_BLK is not set
 CONFIG_CLK=y
 CONFIG_CPU=y
 CONFIG_DM_DEMO=y
index 806caca1226a2d2ddb28111c5684181f061df17c..326ec28b613758150c09a7769aed225edfbba155 100644 (file)
@@ -28,6 +28,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
index 9441b171eeddb37d4417e9750b82424f0ca74b0c..352ddb72763b65c2cd2ecc3c7f51803d5e416dde 100644 (file)
@@ -29,6 +29,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
index d8ecde27b238bd00d6958309d39cb5aa29dd6584..24cd293597392368d6be3ce4165d2ce30f69ab4d 100644 (file)
@@ -28,6 +28,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
index 201a870d7f0d6dad6b30fe2a66ae282979e8eaa7..08aa0e072a5a9f62fefb60bbc8cfda7bb4a68cd2 100644 (file)
@@ -28,6 +28,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_RTL8169=y
index 358fc8f5cc317b70c283549f5a62194d575ff7c3..b5debc4e0fd3ff639700d6b0e27c02a0b65d5a5a 100644 (file)
@@ -30,9 +30,11 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
index 56e7ba367d60fddd97d73ea079bc22b21be92ee9..a3b1b420e958dc44019dd9aefb84e10fbbf6d3e7 100644 (file)
@@ -27,6 +27,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
index 33aa977a20b09ba847a488eec84e93d7ba500939..b7f1b5643c7fd53ab5b32c6e2a5a2bd1d2b0c66a 100644 (file)
@@ -26,6 +26,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_DM=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
index 80eea84dc29731c96a48a2fd8814cd511375806b..fe5aa07f921a7d8a8bb803680339d18f68d8554a 100644 (file)
@@ -1,6 +1,7 @@
 config BLK
        bool "Support block devices"
        depends on DM
+       default y if DM_MMC
        help
          Enable support for block devices, such as SCSI, MMC and USB
          flash sticks. These provide a block-level interface which permits
index 5225cdb1c0eb61c0b8701a6f39c7b69f2f8923c4..807373053c411ecbc21b654f60e136398ebf57c4 100644 (file)
@@ -43,9 +43,6 @@ enum {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/* Note: depends on enum ec_current_image */
-static const char * const ec_current_image_name[] = {"unknown", "RO", "RW"};
-
 void cros_ec_dump_data(const char *name, int cmd, const uint8_t *data, int len)
 {
 #ifdef DEBUG
@@ -750,15 +747,24 @@ int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset, uint32_t size)
 static int cros_ec_flash_write_block(struct cros_ec_dev *dev,
                const uint8_t *data, uint32_t offset, uint32_t size)
 {
-       struct ec_params_flash_write p;
+       struct ec_params_flash_write *p;
+       int ret;
 
-       p.offset = offset;
-       p.size = size;
-       assert(data && p.size <= EC_FLASH_WRITE_VER0_SIZE);
-       memcpy(&p + 1, data, p.size);
+       p = malloc(sizeof(*p) + size);
+       if (!p)
+               return -ENOMEM;
+
+       p->offset = offset;
+       p->size = size;
+       assert(data && p->size <= EC_FLASH_WRITE_VER0_SIZE);
+       memcpy(p + 1, data, p->size);
+
+       ret = ec_command_inptr(dev, EC_CMD_FLASH_WRITE, 0,
+                         p, sizeof(*p) + size, NULL, 0) >= 0 ? 0 : -1;
 
-       return ec_command_inptr(dev, EC_CMD_FLASH_WRITE, 0,
-                         &p, sizeof(p), NULL, 0) >= 0 ? 0 : -1;
+       free(p);
+
+       return ret;
 }
 
 /**
@@ -790,6 +796,27 @@ static int cros_ec_data_is_erased(const uint32_t *data, int size)
        return 1;
 }
 
+/**
+ * Read back flash parameters
+ *
+ * This function reads back parameters of the flash as reported by the EC
+ *
+ * @param dev  Pointer to device
+ * @param info Pointer to output flash info struct
+ */
+int cros_ec_read_flashinfo(struct cros_ec_dev *dev,
+                         struct ec_response_flash_info *info)
+{
+       int ret;
+
+       ret = ec_command(dev, EC_CMD_FLASH_INFO, 0,
+                        NULL, 0, info, sizeof(*info));
+       if (ret < 0)
+               return ret;
+
+       return ret < sizeof(*info) ? -1 : 0;
+}
+
 int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data,
                     uint32_t offset, uint32_t size)
 {
@@ -1134,344 +1161,6 @@ int cros_ec_i2c_tunnel(struct udevice *dev, int port, struct i2c_msg *in,
        return 0;
 }
 
-#ifdef CONFIG_CMD_CROS_EC
-
-/**
- * Perform a flash read or write command
- *
- * @param dev          CROS-EC device to read/write
- * @param is_write     1 do to a write, 0 to do a read
- * @param argc         Number of arguments
- * @param argv         Arguments (2 is region, 3 is address)
- * @return 0 for ok, 1 for a usage error or -ve for ec command error
- *     (negative EC_RES_...)
- */
-static int do_read_write(struct cros_ec_dev *dev, int is_write, int argc,
-                        char * const argv[])
-{
-       uint32_t offset, size = -1U, region_size;
-       unsigned long addr;
-       char *endp;
-       int region;
-       int ret;
-
-       region = cros_ec_decode_region(argc - 2, argv + 2);
-       if (region == -1)
-               return 1;
-       if (argc < 4)
-               return 1;
-       addr = simple_strtoul(argv[3], &endp, 16);
-       if (*argv[3] == 0 || *endp != 0)
-               return 1;
-       if (argc > 4) {
-               size = simple_strtoul(argv[4], &endp, 16);
-               if (*argv[4] == 0 || *endp != 0)
-                       return 1;
-       }
-
-       ret = cros_ec_flash_offset(dev, region, &offset, &region_size);
-       if (ret) {
-               debug("%s: Could not read region info\n", __func__);
-               return ret;
-       }
-       if (size == -1U)
-               size = region_size;
-
-       ret = is_write ?
-               cros_ec_flash_write(dev, (uint8_t *)addr, offset, size) :
-               cros_ec_flash_read(dev, (uint8_t *)addr, offset, size);
-       if (ret) {
-               debug("%s: Could not %s region\n", __func__,
-                     is_write ? "write" : "read");
-               return ret;
-       }
-
-       return 0;
-}
-
-static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       struct cros_ec_dev *dev;
-       struct udevice *udev;
-       const char *cmd;
-       int ret = 0;
-
-       if (argc < 2)
-               return CMD_RET_USAGE;
-
-       cmd = argv[1];
-       if (0 == strcmp("init", cmd)) {
-               /* Remove any existing device */
-               ret = uclass_find_device(UCLASS_CROS_EC, 0, &udev);
-               if (!ret)
-                       device_remove(udev);
-               ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
-               if (ret) {
-                       printf("Could not init cros_ec device (err %d)\n", ret);
-                       return 1;
-               }
-               return 0;
-       }
-
-       ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
-       if (ret) {
-               printf("Cannot get cros-ec device (err=%d)\n", ret);
-               return 1;
-       }
-       dev = dev_get_uclass_priv(udev);
-       if (0 == strcmp("id", cmd)) {
-               char id[MSG_BYTES];
-
-               if (cros_ec_read_id(dev, id, sizeof(id))) {
-                       debug("%s: Could not read KBC ID\n", __func__);
-                       return 1;
-               }
-               printf("%s\n", id);
-       } else if (0 == strcmp("info", cmd)) {
-               struct ec_response_mkbp_info info;
-
-               if (cros_ec_info(dev, &info)) {
-                       debug("%s: Could not read KBC info\n", __func__);
-                       return 1;
-               }
-               printf("rows     = %u\n", info.rows);
-               printf("cols     = %u\n", info.cols);
-               printf("switches = %#x\n", info.switches);
-       } else if (0 == strcmp("curimage", cmd)) {
-               enum ec_current_image image;
-
-               if (cros_ec_read_current_image(dev, &image)) {
-                       debug("%s: Could not read KBC image\n", __func__);
-                       return 1;
-               }
-               printf("%d\n", image);
-       } else if (0 == strcmp("hash", cmd)) {
-               struct ec_response_vboot_hash hash;
-               int i;
-
-               if (cros_ec_read_hash(dev, &hash)) {
-                       debug("%s: Could not read KBC hash\n", __func__);
-                       return 1;
-               }
-
-               if (hash.hash_type == EC_VBOOT_HASH_TYPE_SHA256)
-                       printf("type:    SHA-256\n");
-               else
-                       printf("type:    %d\n", hash.hash_type);
-
-               printf("offset:  0x%08x\n", hash.offset);
-               printf("size:    0x%08x\n", hash.size);
-
-               printf("digest:  ");
-               for (i = 0; i < hash.digest_size; i++)
-                       printf("%02x", hash.hash_digest[i]);
-               printf("\n");
-       } else if (0 == strcmp("reboot", cmd)) {
-               int region;
-               enum ec_reboot_cmd cmd;
-
-               if (argc >= 3 && !strcmp(argv[2], "cold"))
-                       cmd = EC_REBOOT_COLD;
-               else {
-                       region = cros_ec_decode_region(argc - 2, argv + 2);
-                       if (region == EC_FLASH_REGION_RO)
-                               cmd = EC_REBOOT_JUMP_RO;
-                       else if (region == EC_FLASH_REGION_RW)
-                               cmd = EC_REBOOT_JUMP_RW;
-                       else
-                               return CMD_RET_USAGE;
-               }
-
-               if (cros_ec_reboot(dev, cmd, 0)) {
-                       debug("%s: Could not reboot KBC\n", __func__);
-                       return 1;
-               }
-       } else if (0 == strcmp("events", cmd)) {
-               uint32_t events;
-
-               if (cros_ec_get_host_events(dev, &events)) {
-                       debug("%s: Could not read host events\n", __func__);
-                       return 1;
-               }
-               printf("0x%08x\n", events);
-       } else if (0 == strcmp("clrevents", cmd)) {
-               uint32_t events = 0x7fffffff;
-
-               if (argc >= 3)
-                       events = simple_strtol(argv[2], NULL, 0);
-
-               if (cros_ec_clear_host_events(dev, events)) {
-                       debug("%s: Could not clear host events\n", __func__);
-                       return 1;
-               }
-       } else if (0 == strcmp("read", cmd)) {
-               ret = do_read_write(dev, 0, argc, argv);
-               if (ret > 0)
-                       return CMD_RET_USAGE;
-       } else if (0 == strcmp("write", cmd)) {
-               ret = do_read_write(dev, 1, argc, argv);
-               if (ret > 0)
-                       return CMD_RET_USAGE;
-       } else if (0 == strcmp("erase", cmd)) {
-               int region = cros_ec_decode_region(argc - 2, argv + 2);
-               uint32_t offset, size;
-
-               if (region == -1)
-                       return CMD_RET_USAGE;
-               if (cros_ec_flash_offset(dev, region, &offset, &size)) {
-                       debug("%s: Could not read region info\n", __func__);
-                       ret = -1;
-               } else {
-                       ret = cros_ec_flash_erase(dev, offset, size);
-                       if (ret) {
-                               debug("%s: Could not erase region\n",
-                                     __func__);
-                       }
-               }
-       } else if (0 == strcmp("regioninfo", cmd)) {
-               int region = cros_ec_decode_region(argc - 2, argv + 2);
-               uint32_t offset, size;
-
-               if (region == -1)
-                       return CMD_RET_USAGE;
-               ret = cros_ec_flash_offset(dev, region, &offset, &size);
-               if (ret) {
-                       debug("%s: Could not read region info\n", __func__);
-               } else {
-                       printf("Region: %s\n", region == EC_FLASH_REGION_RO ?
-                                       "RO" : "RW");
-                       printf("Offset: %x\n", offset);
-                       printf("Size:   %x\n", size);
-               }
-       } else if (0 == strcmp("vbnvcontext", cmd)) {
-               uint8_t block[EC_VBNV_BLOCK_SIZE];
-               char buf[3];
-               int i, len;
-               unsigned long result;
-
-               if (argc <= 2) {
-                       ret = cros_ec_read_vbnvcontext(dev, block);
-                       if (!ret) {
-                               printf("vbnv_block: ");
-                               for (i = 0; i < EC_VBNV_BLOCK_SIZE; i++)
-                                       printf("%02x", block[i]);
-                               putc('\n');
-                       }
-               } else {
-                       /*
-                        * TODO(clchiou): Move this to a utility function as
-                        * cmd_spi might want to call it.
-                        */
-                       memset(block, 0, EC_VBNV_BLOCK_SIZE);
-                       len = strlen(argv[2]);
-                       buf[2] = '\0';
-                       for (i = 0; i < EC_VBNV_BLOCK_SIZE; i++) {
-                               if (i * 2 >= len)
-                                       break;
-                               buf[0] = argv[2][i * 2];
-                               if (i * 2 + 1 >= len)
-                                       buf[1] = '0';
-                               else
-                                       buf[1] = argv[2][i * 2 + 1];
-                               strict_strtoul(buf, 16, &result);
-                               block[i] = result;
-                       }
-                       ret = cros_ec_write_vbnvcontext(dev, block);
-               }
-               if (ret) {
-                       debug("%s: Could not %s VbNvContext\n", __func__,
-                                       argc <= 2 ?  "read" : "write");
-               }
-       } else if (0 == strcmp("test", cmd)) {
-               int result = cros_ec_test(dev);
-
-               if (result)
-                       printf("Test failed with error %d\n", result);
-               else
-                       puts("Test passed\n");
-       } else if (0 == strcmp("version", cmd)) {
-               struct ec_response_get_version *p;
-               char *build_string;
-
-               ret = cros_ec_read_version(dev, &p);
-               if (!ret) {
-                       /* Print versions */
-                       printf("RO version:    %1.*s\n",
-                              (int)sizeof(p->version_string_ro),
-                              p->version_string_ro);
-                       printf("RW version:    %1.*s\n",
-                              (int)sizeof(p->version_string_rw),
-                              p->version_string_rw);
-                       printf("Firmware copy: %s\n",
-                               (p->current_image <
-                                       ARRAY_SIZE(ec_current_image_name) ?
-                               ec_current_image_name[p->current_image] :
-                               "?"));
-                       ret = cros_ec_read_build_info(dev, &build_string);
-                       if (!ret)
-                               printf("Build info:    %s\n", build_string);
-               }
-       } else if (0 == strcmp("ldo", cmd)) {
-               uint8_t index, state;
-               char *endp;
-
-               if (argc < 3)
-                       return CMD_RET_USAGE;
-               index = simple_strtoul(argv[2], &endp, 10);
-               if (*argv[2] == 0 || *endp != 0)
-                       return CMD_RET_USAGE;
-               if (argc > 3) {
-                       state = simple_strtoul(argv[3], &endp, 10);
-                       if (*argv[3] == 0 || *endp != 0)
-                               return CMD_RET_USAGE;
-                       ret = cros_ec_set_ldo(udev, index, state);
-               } else {
-                       ret = cros_ec_get_ldo(udev, index, &state);
-                       if (!ret) {
-                               printf("LDO%d: %s\n", index,
-                                       state == EC_LDO_STATE_ON ?
-                                       "on" : "off");
-                       }
-               }
-
-               if (ret) {
-                       debug("%s: Could not access LDO%d\n", __func__, index);
-                       return ret;
-               }
-       } else {
-               return CMD_RET_USAGE;
-       }
-
-       if (ret < 0) {
-               printf("Error: CROS-EC command failed (error %d)\n", ret);
-               ret = 1;
-       }
-
-       return ret;
-}
-
-U_BOOT_CMD(
-       crosec, 6,      1,      do_cros_ec,
-       "CROS-EC utility command",
-       "init                Re-init CROS-EC (done on startup automatically)\n"
-       "crosec id                  Read CROS-EC ID\n"
-       "crosec info                Read CROS-EC info\n"
-       "crosec curimage            Read CROS-EC current image\n"
-       "crosec hash                Read CROS-EC hash\n"
-       "crosec reboot [rw | ro | cold]  Reboot CROS-EC\n"
-       "crosec events              Read CROS-EC host events\n"
-       "crosec clrevents [mask]    Clear CROS-EC host events\n"
-       "crosec regioninfo <ro|rw>  Read image info\n"
-       "crosec erase <ro|rw>       Erase EC image\n"
-       "crosec read <ro|rw> <addr> [<size>]   Read EC image\n"
-       "crosec write <ro|rw> <addr> [<size>]  Write EC image\n"
-       "crosec vbnvcontext [hexstring]        Read [write] VbNvContext from EC\n"
-       "crosec ldo <idx> [<state>] Switch/Read LDO state\n"
-       "crosec test                run tests on cros_ec\n"
-       "crosec version             Read CROS-EC version"
-);
-#endif
-
 UCLASS_DRIVER(cros_ec) = {
        .id             = UCLASS_CROS_EC,
        .name           = "cros_ec",
index ba9a7237b44f1d9b3e22d9730c31cee790b1f2a5..24f4b285a904f4b80922dd3680d0a02a881a3869 100644 (file)
@@ -19,6 +19,7 @@ config DM_MMC
 config DM_MMC_OPS
        bool "Support MMC controller operations using Driver Model"
        depends on DM_MMC
+       default y if DM_MMC
        help
          Driver model provides a means of supporting device operations. This
          option moves MMC operations under the control of driver model. The
index d8f8087b680711cf9ae36cd79d7316bcff2b04c7..20bba1a2797481830d7fde7a3d47d0f63c936f1f 100644 (file)
@@ -29,7 +29,6 @@ int atmel_sdhci_init(void *regbase, u32 id)
        host->name = "atmel_sdhci";
        host->ioaddr = regbase;
        host->quirks = 0;
-       host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
        max_clk = at91_get_periph_generated_clk(id);
        if (!max_clk) {
                printf("%s: Failed to get the proper clock\n", __func__);
index 680b754af63e30b5bc6fef4038da6c9c3b0ef349..cb2bd40c65ee198753853c401e48ed8df3156a93 100644 (file)
@@ -157,7 +157,7 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq)
        bcm_host = calloc(1, sizeof(*bcm_host));
        if (!bcm_host) {
                printf("sdhci_host calloc fail!\n");
-               return 1;
+               return -ENOMEM;
        }
 
        /*
@@ -184,7 +184,6 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq)
        host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
        host->ops = &bcm2835_ops;
 
-       host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
        add_sdhci(host, emmc_freq, MIN_FREQ);
 
        return 0;
index 074f86c502c0d2aed6eb1c2ffeedfe5730fdbc81..d6ac46c1e04d93e308c0182191624de9338f1709 100644 (file)
@@ -488,10 +488,10 @@ static const struct mmc_ops dwmci_ops = {
 };
 #endif
 
-void dwmci_setup_cfg(struct mmc_config *cfg, const char *name, int buswidth,
-                    uint caps, u32 max_clk, u32 min_clk)
+void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host,
+               u32 max_clk, u32 min_clk)
 {
-       cfg->name = name;
+       cfg->name = host->name;
 #ifndef CONFIG_DM_MMC_OPS
        cfg->ops = &dwmci_ops;
 #endif
@@ -500,9 +500,9 @@ void dwmci_setup_cfg(struct mmc_config *cfg, const char *name, int buswidth,
 
        cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 
-       cfg->host_caps = caps;
+       cfg->host_caps = host->caps;
 
-       if (buswidth == 8) {
+       if (host->buswidth == 8) {
                cfg->host_caps |= MMC_MODE_8BIT;
                cfg->host_caps &= ~MMC_MODE_4BIT;
        } else {
@@ -522,8 +522,7 @@ int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg)
 #else
 int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk)
 {
-       dwmci_setup_cfg(&host->cfg, host->name, host->buswidth, host->caps,
-                       max_clk, min_clk);
+       dwmci_setup_cfg(&host->cfg, host, max_clk, min_clk);
 
        host->mmc = mmc_create(&host->cfg, host);
        if (host->mmc == NULL)
index 568fed74be82645f38db1d1b3b4afa1b0e34eb46..c440399a09cfa38e0dd569a68c7a8c347ad3633a 100644 (file)
@@ -271,8 +271,7 @@ static int exynos_dwmmc_probe(struct udevice *dev)
        if (err)
                return err;
 
-       dwmci_setup_cfg(&plat->cfg, host->name, host->buswidth, host->caps,
-                       DWMMC_MAX_FREQ, DWMMC_MIN_FREQ);
+       dwmci_setup_cfg(&plat->cfg, host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ);
        host->mmc = &plat->mmc;
        host->mmc->priv = &priv->host;
        host->priv = dev;
index 1f6cdba17349dc860a1a45e835ef92c3a2c2f934..6e9fefab33e2b0204dd80d31a014241a2e8d17c4 100644 (file)
@@ -21,7 +21,7 @@ int ftsdc021_sdhci_init(u32 regbase)
        host = calloc(1, sizeof(struct sdhci_host));
        if (!host) {
                puts("sdh_host malloc fail!\n");
-               return 1;
+               return -ENOMEM;
        }
 
        host->name = "FTSDC021";
index e730caa2079c8db90d30ee5a5bd0609b72d36ed4..549f6bcbbdc2bfd16adad1c6ce9ff39c479afc96 100644 (file)
@@ -27,7 +27,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
 
        if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) {
                printf("%s: sd host controller reset error\n", __func__);
-               return 1;
+               return -EBUSY;
        }
 
        /* For kona a hardware reset before anything else. */
@@ -39,7 +39,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
        do {
                if (timeout == 0) {
                        printf("%s: reset timeout error\n", __func__);
-                       return 1;
+                       return -ETIMEDOUT;
                }
                timeout--;
                udelay(100);
@@ -67,7 +67,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
        while (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) {
                if (timeout == 0) {
                        printf("%s: CARD DETECT timeout error\n", __func__);
-                       return 1;
+                       return -ETIMEDOUT;
                }
                timeout--;
                udelay(100);
@@ -127,11 +127,6 @@ int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks)
                return -EINVAL;
        }
 
-       if (quirks & SDHCI_QUIRK_REG32_RW)
-               host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
-       else
-               host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
        add_sdhci(host, max_clk, min_clk);
        return ret;
 }
index 425abb1b9ef748183909e208fe32210555de09c8..77424cdcea0b698c98e1cd442c2f54afdc045f1e 100644 (file)
@@ -262,6 +262,7 @@ static const struct blk_ops mmc_blk_ops = {
        .read   = mmc_bread,
 #ifndef CONFIG_SPL_BUILD
        .write  = mmc_bwrite,
+       .erase  = mmc_berase,
 #endif
        .select_hwpart  = mmc_select_hwpart,
 };
index d8b399e3641fc6cb241b1bbe22023488ec359031..03bf24d5febdf412943a0841f54c689999cb6b6f 100644 (file)
@@ -29,15 +29,15 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 #endif
 
 #if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
-unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
-                        lbaint_t blkcnt);
 
 #ifdef CONFIG_BLK
 ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
                 const void *src);
+ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
 #else
 ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
                 const void *src);
+ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt);
 #endif
 
 #else /* CONFIG_SPL_BUILD and CONFIG_SPL_SAVEENV is not defined */
index 22896403754beb6c1b1d0481d02ceecf9e3b4f13..54acbf73367b8acbb7d4597ef9c4c9815a05e7f4 100644 (file)
@@ -66,9 +66,15 @@ err_out:
        return err;
 }
 
-unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
-                        lbaint_t blkcnt)
+#ifdef CONFIG_BLK
+ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
+#else
+ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt)
+#endif
 {
+#ifdef CONFIG_BLK
+       struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
+#endif
        int dev_num = block_dev->devnum;
        int err = 0;
        u32 start_rem, blkcnt_rem;
index 1b82991c0ee2aa23390ad225570b8d73b4cc9d04..f33714b1d8193af233a2f68b7006672a3ed2b55a 100644 (file)
@@ -140,9 +140,6 @@ static int msm_sdc_probe(struct udevice *dev)
                writel(caps, host->ioaddr + SDHCI_VENDOR_SPEC_CAPABILITIES0);
        }
 
-       /* Set host controller version */
-       host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
        ret = sdhci_setup_cfg(&plat->cfg, host, 0, 0);
        host->mmc = &plat->mmc;
        if (ret)
index 82c695f906079a0a1a568b29d223f0b7bb8b51fc..e388ad171b54a33903b643ad910c0b405ef854c5 100644 (file)
@@ -71,7 +71,7 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
        host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
        if (!host) {
                printf("sdh_host malloc fail!\n");
-               return 1;
+               return -ENOMEM;
        }
 
        host->name = MVSDH_NAME;
@@ -88,9 +88,5 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
                sdhci_mvebu_mbus_config((void __iomem *)regbase);
        }
 
-       if (quirks & SDHCI_QUIRK_REG32_RW)
-               host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
-       else
-               host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
        return add_sdhci(host, max_clk, min_clk);
 }
index 340eef6a1f38c49e400244a55d69f7c75ecfaedc..3d587cc97d6653042eefa2f281e8d8b5cc9e6fcb 100644 (file)
@@ -30,7 +30,7 @@ int pci_mmc_init(const char *name, struct pci_device_id *mmc_supported)
 
                mmc_host->name = name;
                dm_pci_read_config32(dev, PCI_BASE_ADDRESS_0, &iobase);
-               mmc_host->ioaddr = (void *)iobase;
+               mmc_host->ioaddr = (void *)(ulong)iobase;
                mmc_host->quirks = 0;
                ret = add_sdhci(mmc_host, 0, 0);
                if (ret)
index 859760b8b0abb4c2f75937d01c23695577814ade..47db6786cfce47334d4d387562c3dd6490318289 100644 (file)
@@ -129,8 +129,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
                        return ret;
        }
 #endif
-       dwmci_setup_cfg(&plat->cfg, dev->name, host->buswidth, host->caps,
-                       priv->minmax[1], priv->minmax[0]);
+       dwmci_setup_cfg(&plat->cfg, host, priv->minmax[1], priv->minmax[0]);
        host->mmc = &plat->mmc;
        host->mmc->priv = &priv->host;
        host->mmc->dev = dev;
index 3bace21a046b4564bff4c4c39373e538fb15d48f..b329bef5fd4261e8d40e4a0b32f2d0c5b9f0beec 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <malloc.h>
 #include <sdhci.h>
 #include <fdtdec.h>
 #include <errno.h>
 #include <asm/arch/pinmux.h>
 
+#ifdef CONFIG_DM_MMC
+struct s5p_sdhci_plat {
+       struct mmc_config cfg;
+       struct mmc mmc;
+};
+
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 static char *S5P_NAME = "SAMSUNG SDHCI";
 static void s5p_sdhci_set_control_reg(struct sdhci_host *host)
 {
@@ -71,7 +81,6 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
                SDHCI_QUIRK_32BIT_DMA_ADDR |
                SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_USE_WIDE8;
        host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
-       host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 
        host->set_control_reg = &s5p_sdhci_set_control_reg;
        host->set_clock = set_mmc_clk;
@@ -79,7 +88,11 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
        if (host->bus_width == 8)
                host->host_caps |= MMC_MODE_8BIT;
 
+#ifndef CONFIG_BLK
        return add_sdhci(host, 52000000, 400000);
+#else
+       return 0;
+#endif
 }
 
 int s5p_sdhci_init(u32 regbase, int index, int bus_width)
@@ -87,7 +100,7 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width)
        struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host));
        if (!host) {
                printf("sdhci__host allocation fail!\n");
-               return 1;
+               return -ENOMEM;
        }
        host->ioaddr = (void *)regbase;
        host->index = index;
@@ -141,7 +154,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
        dev_id = pinmux_decode_periph_id(blob, node);
        if (dev_id < PERIPH_ID_SDMMC0 && dev_id > PERIPH_ID_SDMMC3) {
                debug("MMC: Can't get device id\n");
-               return -1;
+               return -EINVAL;
        }
        host->index = dev_id - PERIPH_ID_SDMMC0;
 
@@ -149,7 +162,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
        bus_width = fdtdec_get_int(blob, node, "samsung,bus-width", 0);
        if (bus_width <= 0) {
                debug("MMC: Can't get bus-width\n");
-               return -1;
+               return -EINVAL;
        }
        host->bus_width = bus_width;
 
@@ -157,7 +170,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
        base = fdtdec_get_addr(blob, node, "reg");
        if (!base) {
                debug("MMC: Can't get base address\n");
-               return -1;
+               return -EINVAL;
        }
        host->ioaddr = (void *)base;
 
@@ -215,3 +228,60 @@ int exynos_mmc_init(const void *blob)
        return process_nodes(blob, node_list, count);
 }
 #endif
+
+#ifdef CONFIG_DM_MMC
+static int s5p_sdhci_probe(struct udevice *dev)
+{
+       struct s5p_sdhci_plat *plat = dev_get_platdata(dev);
+       struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+       struct sdhci_host *host = dev_get_priv(dev);
+       int ret;
+
+       ret = sdhci_get_config(gd->fdt_blob, dev->of_offset, host);
+       if (ret)
+               return ret;
+
+       ret = do_sdhci_init(host);
+       if (ret)
+               return ret;
+
+       ret = sdhci_setup_cfg(&plat->cfg, host, 52000000, 400000);
+       if (ret)
+               return ret;
+
+       host->mmc = &plat->mmc;
+       host->mmc->priv = host;
+       host->mmc->dev = dev;
+       upriv->mmc = host->mmc;
+
+       return sdhci_probe(dev);
+}
+
+static int s5p_sdhci_bind(struct udevice *dev)
+{
+       struct s5p_sdhci_plat *plat = dev_get_platdata(dev);
+       int ret;
+
+       ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
+static const struct udevice_id s5p_sdhci_ids[] = {
+       { .compatible = "samsung,exynos4412-sdhci"},
+       { }
+};
+
+U_BOOT_DRIVER(s5p_sdhci_drv) = {
+       .name           = "s5p_sdhci",
+       .id             = UCLASS_MMC,
+       .of_match       = s5p_sdhci_ids,
+       .bind           = s5p_sdhci_bind,
+       .ops            = &sdhci_ops,
+       .probe          = s5p_sdhci_probe,
+       .priv_auto_alloc_size = sizeof(struct sdhci_host),
+       .platdata_auto_alloc_size = sizeof(struct s5p_sdhci_plat),
+};
+#endif /* CONFIG_DM_MMC */
index b2bf5a03fa84d9c1be6895bb0ef995cb5c7f6b94..837c53842b3802700ca192692c9ead0e2d220590 100644 (file)
@@ -87,7 +87,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
                if (stat & SDHCI_INT_ERROR) {
                        printf("%s: Error detected in status(0x%X)!\n",
                               __func__, stat);
-                       return -1;
+                       return -EIO;
                }
                if (stat & rdy) {
                        if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & mask))
@@ -110,7 +110,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
                        udelay(10);
                else {
                        printf("%s: Transfer data timeout\n", __func__);
-                       return -1;
+                       return -ETIMEDOUT;
                }
        } while (!(stat & SDHCI_INT_DATA_END));
        return 0;
@@ -303,7 +303,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
                if (timeout == 0) {
                        printf("%s: Timeout to wait cmd & data inhibit\n",
                               __func__);
-                       return -1;
+                       return -EBUSY;
                }
 
                timeout--;
@@ -374,7 +374,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
                if (timeout == 0) {
                        printf("%s: Internal clock never stabilised.\n",
                               __func__);
-                       return -1;
+                       return -EBUSY;
                }
                timeout--;
                udelay(1000);
@@ -477,7 +477,7 @@ static int sdhci_init(struct mmc *mmc)
                if (!aligned_buffer) {
                        printf("%s: Aligned buffer alloc failed!!!\n",
                               __func__);
-                       return -1;
+                       return -ENOMEM;
                }
        }
 
@@ -546,7 +546,11 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
                return -EINVAL;
        }
 #endif
-       host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+       if (host->quirks & SDHCI_QUIRK_REG32_RW)
+               host->version =
+                       sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
+       else
+               host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 
        cfg->name = host->name;
 #ifndef CONFIG_DM_MMC_OPS
@@ -627,7 +631,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
        host->mmc = mmc_create(&host->cfg, host);
        if (host->mmc == NULL) {
                printf("%s: mmc create fail!\n", __func__);
-               return -1;
+               return -ENOMEM;
        }
 
        return 0;
index 8a9630208c5b5f27b70c884864b8aefad53e7348..5a3a4ff4032f4751849af08fdbb8c6c55dff73c0 100644 (file)
@@ -111,8 +111,7 @@ static int socfpga_dwmmc_probe(struct udevice *dev)
        struct dwmci_host *host = &priv->host;
 
 #ifdef CONFIG_BLK
-       dwmci_setup_cfg(&plat->cfg, dev->name, host->buswidth, host->caps,
-                       host->bus_hz, 400000);
+       dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000);
        host->mmc = &plat->mmc;
 #else
        int ret;
index 6ca96a2d06ac5fb7113679ded3b79693f739ea0d..06179cd9f4165f0f3570898cee499d469c129d65 100644 (file)
@@ -22,11 +22,6 @@ int spear_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
        host->ioaddr = (void *)regbase;
        host->quirks = quirks;
 
-       if (quirks & SDHCI_QUIRK_REG32_RW)
-               host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
-       else
-               host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
        add_sdhci(host, max_clk, min_clk);
        return 0;
 }
index b991102c2a1438d5e9cb664040b31e7578dca551..3da138562ab9494bb88aefefa4f4fc79e704ceee 100644 (file)
@@ -36,8 +36,6 @@ static int arasan_sdhci_probe(struct udevice *dev)
        host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
 #endif
 
-       host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
        ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
                              CONFIG_ZYNQ_SDHCI_MIN_FREQ);
        host->mmc = &plat->mmc;
index 13d293a93d30d2d439f72ddbd4f931df10396f85..ce204b36caad6ca83cf46541ee5a02cdf2386ab1 100644 (file)
@@ -143,3 +143,17 @@ config PMIC_TPS65090
        FETs and a battery charger. This driver provides register access
        only, and you can enable the regulator/charger drivers separately if
        required.
+
+config PMIC_PALMAS
+       bool "Enable driver for Texas Instruments PALMAS PMIC"
+       depends on DM_PMIC
+       ---help---
+       The PALMAS is a PMIC containing several LDOs, SMPS.
+       This driver binds the pmic children.
+
+config PMIC_LP873X
+       bool "Enable driver for Texas Instruments LP873X PMIC"
+       depends on DM_PMIC
+       ---help---
+       The LP873X is a PMIC containing couple of LDOs and couple of SMPS.
+       This driver binds the pmic children.
index 37d9eb55991f4348a7f8cdde2e90a96a6c8fd66c..cd1c6945cd2352a63e054286df658d6bd4fe18e9 100644 (file)
@@ -16,6 +16,8 @@ obj-$(CONFIG_PMIC_RK808) += rk808.o
 obj-$(CONFIG_PMIC_RN5T567) += rn5t567.o
 obj-$(CONFIG_PMIC_TPS65090) += tps65090.o
 obj-$(CONFIG_PMIC_S5M8767) += s5m8767.o
+obj-$(CONFIG_$(SPL_)PMIC_PALMAS) += palmas.o
+obj-$(CONFIG_$(SPL_)PMIC_LP873X) += lp873x.o
 
 obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o
 obj-$(CONFIG_POWER_MAX77696) += pmic_max77696.o
diff --git a/drivers/power/pmic/lp873x.c b/drivers/power/pmic/lp873x.c
new file mode 100644 (file)
index 0000000..307f96b
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * (C) Copyright 2016 Texas Instruments Incorporated, <www.ti.com>
+ * Keerthy <j-keerthy@ti.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/lp873x.h>
+#include <dm/device.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct pmic_child_info pmic_children_info[] = {
+       { .prefix = "ldo", .driver = LP873X_LDO_DRIVER },
+       { .prefix = "buck", .driver = LP873X_BUCK_DRIVER },
+       { },
+};
+
+static int lp873x_write(struct udevice *dev, uint reg, const uint8_t *buff,
+                         int len)
+{
+       if (dm_i2c_write(dev, reg, buff, len)) {
+               error("write error to device: %p register: %#x!", dev, reg);
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static int lp873x_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+       if (dm_i2c_read(dev, reg, buff, len)) {
+               error("read error from device: %p register: %#x!", dev, reg);
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static int lp873x_bind(struct udevice *dev)
+{
+       int regulators_node;
+       const void *blob = gd->fdt_blob;
+       int children;
+       int node = dev->of_offset;
+
+       regulators_node = fdt_subnode_offset(blob, node, "regulators");
+
+       if (regulators_node <= 0) {
+               printf("%s: %s reg subnode not found!", __func__, dev->name);
+               return -ENXIO;
+       }
+
+       children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+       if (!children)
+               printf("%s: %s - no child found\n", __func__, dev->name);
+
+       /* Always return success for this device */
+       return 0;
+}
+
+static struct dm_pmic_ops lp873x_ops = {
+       .read = lp873x_read,
+       .write = lp873x_write,
+};
+
+static const struct udevice_id lp873x_ids[] = {
+       { .compatible = "ti,lp8732", .data = LP8732 },
+       { .compatible = "ti,lp8733" , .data = LP8733 },
+       { }
+};
+
+U_BOOT_DRIVER(pmic_lp873x) = {
+       .name = "lp873x_pmic",
+       .id = UCLASS_PMIC,
+       .of_match = lp873x_ids,
+       .bind = lp873x_bind,
+       .ops = &lp873x_ops,
+};
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c
new file mode 100644 (file)
index 0000000..6c79a93
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * (C) Copyright 2016 Texas Instruments Incorporated, <www.ti.com>
+ * Keerthy <j-keerthy@ti.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/palmas.h>
+#include <dm/device.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct pmic_child_info pmic_children_info[] = {
+       { .prefix = "ldo", .driver = PALMAS_LDO_DRIVER },
+       { .prefix = "smps", .driver = PALMAS_SMPS_DRIVER },
+       { },
+};
+
+static int palmas_write(struct udevice *dev, uint reg, const uint8_t *buff,
+                         int len)
+{
+       if (dm_i2c_write(dev, reg, buff, len)) {
+               error("write error to device: %p register: %#x!", dev, reg);
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static int palmas_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+       if (dm_i2c_read(dev, reg, buff, len)) {
+               error("read error from device: %p register: %#x!", dev, reg);
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static int palmas_bind(struct udevice *dev)
+{
+       int pmic_node = -1, regulators_node;
+       const void *blob = gd->fdt_blob;
+       int children;
+       int node = dev->of_offset;
+       int subnode, len;
+
+       fdt_for_each_subnode(blob, subnode, node) {
+               const char *name;
+               char *temp;
+
+               name = fdt_get_name(blob, subnode, &len);
+               temp = strstr(name, "pmic");
+               if (temp) {
+                       pmic_node = subnode;
+                       break;
+               }
+       }
+
+       if (pmic_node <= 0) {
+               debug("%s: %s pmic subnode not found!", __func__, dev->name);
+               return -ENXIO;
+       }
+
+       regulators_node = fdt_subnode_offset(blob, pmic_node, "regulators");
+
+       if (regulators_node <= 0) {
+               debug("%s: %s reg subnode not found!", __func__, dev->name);
+               return -ENXIO;
+       }
+
+       children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+       if (!children)
+               debug("%s: %s - no child found\n", __func__, dev->name);
+
+       /* Always return success for this device */
+       return 0;
+}
+
+static struct dm_pmic_ops palmas_ops = {
+       .read = palmas_read,
+       .write = palmas_write,
+};
+
+static const struct udevice_id palmas_ids[] = {
+       { .compatible = "ti,tps659038", .data = TPS659038 },
+       { .compatible = "ti,tps65917" , .data = TPS65917 },
+       { }
+};
+
+U_BOOT_DRIVER(pmic_palmas) = {
+       .name = "palmas_pmic",
+       .id = UCLASS_PMIC,
+       .of_match = palmas_ids,
+       .bind = palmas_bind,
+       .ops = &palmas_ops,
+};
index c7e88c00817876be4107a6f6474855f930e49bb8..f870e8bcc9feae67aa0a0114d32478570da2de64 100644 (file)
@@ -68,6 +68,14 @@ config DM_REGULATOR_FIXED
        features for fixed value regulators. The driver implements get/set api
        for enable and get only for voltage value.
 
+config DM_REGULATOR_GPIO
+       bool "Enable Driver Model for GPIO REGULATOR"
+       depends on DM_REGULATOR
+       ---help---
+       This config enables implementation of driver-model regulator uclass
+       features for gpio regulators. The driver implements get/set for
+       voltage value.
+
 config REGULATOR_RK808
        bool "Enable driver for RK808 regulators"
        depends on DM_REGULATOR && PMIC_RK808
@@ -125,3 +133,19 @@ config REGULATOR_TPS65090
        regulators, one for each FET. The standard regulator interface is
        supported, but it is only possible to turn the regulators on or off.
        There is no voltage/current control.
+
+config DM_REGULATOR_PALMAS
+       bool "Enable driver for PALMAS PMIC regulators"
+       depends on PMIC_PALMAS
+       ---help---
+       This enables implementation of driver-model regulator uclass
+       features for REGULATOR PALMAS and the family of PALMAS PMICs.
+       The driver implements get/set api for: value and enable.
+
+config DM_REGULATOR_LP873X
+       bool "Enable driver for LP873X PMIC regulators"
+        depends on PMIC_LP873X
+       ---help---
+       This enables implementation of driver-model regulator uclass
+       features for REGULATOR LP873X and the family of LP873X PMICs.
+       The driver implements get/set api for: value and enable.
index ab461ec3efee14c6bd68e7989356100c358f80a3..6002c88a6c17d80826fc5ce03ff26d69b4626cdf 100644 (file)
@@ -11,7 +11,10 @@ obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o
 obj-$(CONFIG_DM_REGULATOR_PFUZE100) += pfuze100.o
 obj-$(CONFIG_REGULATOR_PWM) += pwm_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_FIXED) += fixed.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_GPIO) += gpio-regulator.o
 obj-$(CONFIG_REGULATOR_RK808) += rk808.o
 obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
 obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o
 obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP873X) += lp873x_regulator.o
diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c
new file mode 100644 (file)
index 0000000..0a60a9c
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * (C) Copyright 2016 Texas Instruments Incorporated, <www.ti.com>
+ * Keerthy <j-keerthy@ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <asm/gpio.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+
+#define GPIO_REGULATOR_MAX_STATES      2
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct gpio_regulator_platdata {
+       struct gpio_desc gpio; /* GPIO for regulator voltage control */
+       int states[GPIO_REGULATOR_MAX_STATES];
+       int voltages[GPIO_REGULATOR_MAX_STATES];
+};
+
+static int gpio_regulator_ofdata_to_platdata(struct udevice *dev)
+{
+       struct dm_regulator_uclass_platdata *uc_pdata;
+       struct gpio_regulator_platdata *dev_pdata;
+       struct gpio_desc *gpio;
+       const void *blob = gd->fdt_blob;
+       int node = dev->of_offset;
+       int ret, count, i, j;
+       u32 states_array[8];
+
+       dev_pdata = dev_get_platdata(dev);
+       uc_pdata = dev_get_uclass_platdata(dev);
+       if (!uc_pdata)
+               return -ENXIO;
+
+       /* Set type to gpio */
+       uc_pdata->type = REGULATOR_TYPE_GPIO;
+
+       /*
+        * Get gpio regulator gpio desc
+        * Assuming one GPIO per regulator.
+        * Can be extended later to multiple GPIOs
+        * per gpio-regulator. As of now no instance with multiple
+        * gpios is presnt
+        */
+       gpio = &dev_pdata->gpio;
+       ret = gpio_request_by_name(dev, "gpios", 0, gpio, GPIOD_IS_OUT);
+       if (ret)
+               debug("regulator gpio - not found! Error: %d", ret);
+
+       count = fdtdec_get_int_array_count(blob, node, "states",
+                                          states_array, 8);
+
+       if (!count)
+               return -EINVAL;
+
+       for (i = 0, j = 0; i < count; i += 2) {
+               dev_pdata->voltages[j] = states_array[i];
+               dev_pdata->states[j] = states_array[i + 1];
+               j++;
+       }
+
+       return 0;
+}
+
+static int gpio_regulator_get_value(struct udevice *dev)
+{
+       struct dm_regulator_uclass_platdata *uc_pdata;
+       struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev);
+       int enable;
+
+       if (!dev_pdata->gpio.dev)
+               return -ENOSYS;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+       if (uc_pdata->min_uV > uc_pdata->max_uV) {
+               debug("Invalid constraints for: %s\n", uc_pdata->name);
+               return -EINVAL;
+       }
+
+       enable = dm_gpio_get_value(&dev_pdata->gpio);
+       if (enable == dev_pdata->states[0])
+               return dev_pdata->voltages[0];
+       else
+               return dev_pdata->voltages[1];
+}
+
+static int gpio_regulator_set_value(struct udevice *dev, int uV)
+{
+       struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev);
+       int ret;
+       bool enable;
+
+       if (!dev_pdata->gpio.dev)
+               return -ENOSYS;
+
+       if (uV == dev_pdata->voltages[0])
+               enable = dev_pdata->states[0];
+       else if (uV == dev_pdata->voltages[1])
+               enable = dev_pdata->states[1];
+       else
+               return -EINVAL;
+
+       ret = dm_gpio_set_value(&dev_pdata->gpio, enable);
+       if (ret) {
+               error("Can't set regulator : %s gpio to: %d\n", dev->name,
+                     enable);
+               return ret;
+       }
+
+       return 0;
+}
+
+static const struct dm_regulator_ops gpio_regulator_ops = {
+       .get_value      = gpio_regulator_get_value,
+       .set_value      = gpio_regulator_set_value,
+};
+
+static const struct udevice_id gpio_regulator_ids[] = {
+       { .compatible = "regulator-gpio" },
+       { },
+};
+
+U_BOOT_DRIVER(gpio_regulator) = {
+       .name = "gpio regulator",
+       .id = UCLASS_REGULATOR,
+       .ops = &gpio_regulator_ops,
+       .of_match = gpio_regulator_ids,
+       .ofdata_to_platdata = gpio_regulator_ofdata_to_platdata,
+       .platdata_auto_alloc_size = sizeof(struct gpio_regulator_platdata),
+};
diff --git a/drivers/power/regulator/lp873x_regulator.c b/drivers/power/regulator/lp873x_regulator.c
new file mode 100644 (file)
index 0000000..dcb19ff
--- /dev/null
@@ -0,0 +1,357 @@
+/*
+ * (C) Copyright 2016
+ * Texas Instruments Incorporated, <www.ti.com>
+ *
+ * Keerthy <j-keerthy@ti.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/lp873x.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const char lp873x_buck_ctrl[LP873X_BUCK_NUM] = {0x2, 0x4};
+static const char lp873x_buck_volt[LP873X_BUCK_NUM] = {0x6, 0x7};
+static const char lp873x_ldo_ctrl[LP873X_LDO_NUM] = {0x8, 0x9};
+static const char lp873x_ldo_volt[LP873X_LDO_NUM] = {0xA, 0xB};
+
+static int lp873x_buck_enable(struct udevice *dev, int op, bool *enable)
+{
+       int ret;
+       unsigned int adr;
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+       adr = uc_pdata->ctrl_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+       if (ret < 0)
+               return ret;
+
+       if (op == PMIC_OP_GET) {
+               ret &= LP873X_BUCK_MODE_MASK;
+
+               if (ret)
+                       *enable = true;
+               else
+                       *enable = false;
+
+               return 0;
+       } else if (op == PMIC_OP_SET) {
+               if (*enable)
+                       ret |= LP873X_BUCK_MODE_MASK;
+               else
+                       ret &= ~(LP873X_BUCK_MODE_MASK);
+               ret = pmic_reg_write(dev->parent, adr, ret);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
+static int lp873x_buck_volt2hex(int uV)
+{
+       if (uV > LP873X_BUCK_VOLT_MAX)
+               return -EINVAL;
+       else if (uV > 1400000)
+               return (uV - 1420000) / 20000 + 0x9E;
+       else if (uV > 730000)
+               return (uV - 735000) / 5000 + 0x18;
+       else if (uV >= 700000)
+               return (uV - 700000) / 10000 + 0x1;
+       else
+               return -EINVAL;
+}
+
+static int lp873x_buck_hex2volt(int hex)
+{
+       if (hex > LP873X_BUCK_VOLT_MAX_HEX)
+               return -EINVAL;
+       else if (hex > 0x9D)
+               return 1400000 + (hex - 0x9D) * 20000;
+       else if (hex > 0x17)
+               return 730000 + (hex - 0x17) * 5000;
+       else if (hex >= 0x14)
+               return 700000 + (hex - 0x14) * 10000;
+       else
+               return -EINVAL;
+}
+
+static int lp873x_buck_val(struct udevice *dev, int op, int *uV)
+{
+       unsigned int hex, adr;
+       int ret;
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+
+       if (op == PMIC_OP_GET)
+               *uV = 0;
+
+       adr = uc_pdata->volt_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+       if (ret < 0)
+               return ret;
+
+       if (op == PMIC_OP_GET) {
+               ret &= LP873X_BUCK_VOLT_MASK;
+               ret = lp873x_buck_hex2volt(ret);
+               if (ret < 0)
+                       return ret;
+               *uV = ret;
+
+               return 0;
+       }
+
+       hex = lp873x_buck_volt2hex(*uV);
+       if (hex < 0)
+               return hex;
+
+       ret &= 0x0;
+       ret |= hex;
+
+       ret = pmic_reg_write(dev->parent, adr, ret);
+
+       return ret;
+}
+
+static int lp873x_ldo_enable(struct udevice *dev, int op, bool *enable)
+{
+       int ret;
+       unsigned int adr;
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+       adr = uc_pdata->ctrl_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+       if (ret < 0)
+               return ret;
+
+       if (op == PMIC_OP_GET) {
+               ret &= LP873X_LDO_MODE_MASK;
+
+               if (ret)
+                       *enable = true;
+               else
+                       *enable = false;
+
+               return 0;
+       } else if (op == PMIC_OP_SET) {
+               if (*enable)
+                       ret |= LP873X_LDO_MODE_MASK;
+               else
+                       ret &= ~(LP873X_LDO_MODE_MASK);
+
+               ret = pmic_reg_write(dev->parent, adr, ret);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
+static int lp873x_ldo_volt2hex(int uV)
+{
+       if (uV > LP873X_LDO_VOLT_MAX)
+               return -EINVAL;
+
+       return (uV - 800000) / 100000;
+}
+
+static int lp873x_ldo_hex2volt(int hex)
+{
+       if (hex > LP873X_LDO_VOLT_MAX_HEX)
+               return -EINVAL;
+
+       if (!hex)
+               return 0;
+
+       return (hex * 100000) + 800000;
+}
+
+static int lp873x_ldo_val(struct udevice *dev, int op, int *uV)
+{
+       unsigned int hex, adr;
+       int ret;
+
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       if (op == PMIC_OP_GET)
+               *uV = 0;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+
+       adr = uc_pdata->volt_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+       if (ret < 0)
+               return ret;
+
+       if (op == PMIC_OP_GET) {
+               ret &= LP873X_LDO_VOLT_MASK;
+               ret = lp873x_ldo_hex2volt(ret);
+               if (ret < 0)
+                       return ret;
+               *uV = ret;
+               return 0;
+       }
+
+       hex = lp873x_ldo_volt2hex(*uV);
+       if (hex < 0)
+               return hex;
+
+       ret &= ~LP873X_LDO_VOLT_MASK;
+       ret |= hex;
+       if (*uV > 1650000)
+               ret |= 0x80;
+       ret = pmic_reg_write(dev->parent, adr, ret);
+
+       return ret;
+}
+
+static int lp873x_ldo_probe(struct udevice *dev)
+{
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+       uc_pdata->type = REGULATOR_TYPE_LDO;
+
+       int idx = dev->driver_data;
+       if (idx >= LP873X_LDO_NUM) {
+               printf("Wrong ID for regulator\n");
+               return -1;
+       }
+
+       uc_pdata->ctrl_reg = lp873x_ldo_ctrl[idx];
+       uc_pdata->volt_reg = lp873x_ldo_volt[idx];
+
+       return 0;
+}
+
+static int ldo_get_value(struct udevice *dev)
+{
+       int uV;
+       int ret;
+
+       ret = lp873x_ldo_val(dev, PMIC_OP_GET, &uV);
+       if (ret)
+               return ret;
+
+       return uV;
+}
+
+static int ldo_set_value(struct udevice *dev, int uV)
+{
+       return lp873x_ldo_val(dev, PMIC_OP_SET, &uV);
+}
+
+static bool ldo_get_enable(struct udevice *dev)
+{
+       bool enable = false;
+       int ret;
+
+       ret = lp873x_ldo_enable(dev, PMIC_OP_GET, &enable);
+       if (ret)
+               return ret;
+
+       return enable;
+}
+
+static int ldo_set_enable(struct udevice *dev, bool enable)
+{
+       return lp873x_ldo_enable(dev, PMIC_OP_SET, &enable);
+}
+
+static int lp873x_buck_probe(struct udevice *dev)
+{
+       struct dm_regulator_uclass_platdata *uc_pdata;
+       int idx;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+       uc_pdata->type = REGULATOR_TYPE_BUCK;
+
+       idx = dev->driver_data;
+       if (idx >= LP873X_BUCK_NUM) {
+               printf("Wrong ID for regulator\n");
+               return -1;
+       }
+
+       uc_pdata->ctrl_reg = lp873x_buck_ctrl[idx];
+       uc_pdata->volt_reg = lp873x_buck_volt[idx];
+
+       return 0;
+}
+
+static int buck_get_value(struct udevice *dev)
+{
+       int uV;
+       int ret;
+
+       ret = lp873x_buck_val(dev, PMIC_OP_GET, &uV);
+       if (ret)
+               return ret;
+
+       return uV;
+}
+
+static int buck_set_value(struct udevice *dev, int uV)
+{
+       return lp873x_buck_val(dev, PMIC_OP_SET, &uV);
+}
+
+static bool buck_get_enable(struct udevice *dev)
+{
+       bool enable = false;
+       int ret;
+
+
+       ret = lp873x_buck_enable(dev, PMIC_OP_GET, &enable);
+       if (ret)
+               return ret;
+
+       return enable;
+}
+
+static int buck_set_enable(struct udevice *dev, bool enable)
+{
+       return lp873x_buck_enable(dev, PMIC_OP_SET, &enable);
+}
+
+static const struct dm_regulator_ops lp873x_ldo_ops = {
+       .get_value  = ldo_get_value,
+       .set_value  = ldo_set_value,
+       .get_enable = ldo_get_enable,
+       .set_enable = ldo_set_enable,
+};
+
+U_BOOT_DRIVER(lp873x_ldo) = {
+       .name = LP873X_LDO_DRIVER,
+       .id = UCLASS_REGULATOR,
+       .ops = &lp873x_ldo_ops,
+       .probe = lp873x_ldo_probe,
+};
+
+static const struct dm_regulator_ops lp873x_buck_ops = {
+       .get_value  = buck_get_value,
+       .set_value  = buck_set_value,
+       .get_enable = buck_get_enable,
+       .set_enable = buck_set_enable,
+};
+
+U_BOOT_DRIVER(lp873x_buck) = {
+       .name = LP873X_BUCK_DRIVER,
+       .id = UCLASS_REGULATOR,
+       .ops = &lp873x_buck_ops,
+       .probe = lp873x_buck_probe,
+};
diff --git a/drivers/power/regulator/palmas_regulator.c b/drivers/power/regulator/palmas_regulator.c
new file mode 100644 (file)
index 0000000..cce7cd2
--- /dev/null
@@ -0,0 +1,453 @@
+/*
+ * (C) Copyright 2016
+ * Texas Instruments Incorporated, <www.ti.com>
+ *
+ * Keerthy <j-keerthy@ti.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/palmas.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define        REGULATOR_ON            0x1
+#define        REGULATOR_OFF           0x0
+
+#define        SMPS_MODE_MASK          0x3
+#define        SMPS_MODE_SHIFT         0x0
+#define        LDO_MODE_MASK           0x1
+#define        LDO_MODE_SHIFT          0x0
+
+static const char palmas_smps_ctrl[][PALMAS_SMPS_NUM] = {
+       {0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3c},
+       {0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38},
+       {0x20, 0x24, 0x2c, 0x30, 0x38},
+};
+
+static const char palmas_smps_volt[][PALMAS_SMPS_NUM] = {
+       {0x23, 0x27, 0x2b, 0x2f, 0x33, 0x37, 0x3b, 0x3c},
+       {0x23, 0x27, 0x2b, 0x2f, 0x33, 0x37, 0x3b},
+       {0x23, 0x27, 0x2f, 0x33, 0x3B}
+};
+
+static const char palmas_ldo_ctrl[][PALMAS_LDO_NUM] = {
+       {0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64},
+       {0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64},
+       {0x50, 0x52, 0x54, 0x5e, 0x62}
+};
+
+static const char palmas_ldo_volt[][PALMAS_LDO_NUM] = {
+       {0x51, 0x53, 0x55, 0x57, 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65},
+       {0x51, 0x53, 0x55, 0x57, 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65},
+       {0x51, 0x53, 0x55, 0x5f, 0x63}
+};
+
+static int palmas_smps_enable(struct udevice *dev, int op, bool *enable)
+{
+       int ret;
+       unsigned int adr;
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+       adr = uc_pdata->ctrl_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+               if (ret < 0)
+                       return ret;
+
+       if (op == PMIC_OP_GET) {
+               ret &= PALMAS_SMPS_STATUS_MASK;
+
+               if (ret)
+                       *enable = true;
+               else
+                       *enable = false;
+
+               return 0;
+       } else if (op == PMIC_OP_SET) {
+               if (*enable)
+                       ret |= PALMAS_SMPS_MODE_MASK;
+               else
+                       ret &= ~(PALMAS_SMPS_MODE_MASK);
+
+               ret = pmic_reg_write(dev->parent, adr, ret);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
+static int palmas_smps_volt2hex(int uV)
+{
+       if (uV > PALMAS_LDO_VOLT_MAX)
+               return -EINVAL;
+
+       if (uV > 1650000)
+               return (uV - 1000000) / 20000 + 0x6;
+
+       if (uV == 500000)
+               return 0x6;
+       else
+               return 0x6 + ((uV - 500000) / 10000);
+}
+
+static int palmas_smps_hex2volt(int hex, bool range)
+{
+       unsigned int uV = 0;
+
+       if (hex > PALMAS_SMPS_VOLT_MAX_HEX)
+               return -EINVAL;
+
+       if (hex < 0x7)
+               uV = 500000;
+       else
+               uV = 500000 + (hex - 0x6) * 10000;
+
+       if (range)
+               uV *= 2;
+
+       return uV;
+}
+
+static int palmas_smps_val(struct udevice *dev, int op, int *uV)
+{
+       unsigned int hex, adr;
+       int ret;
+       bool range;
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+
+       if (op == PMIC_OP_GET)
+               *uV = 0;
+
+       adr = uc_pdata->volt_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+       if (ret < 0)
+               return ret;
+
+       if (op == PMIC_OP_GET) {
+               if (ret & PALMAS_SMPS_RANGE_MASK)
+                       range =  true;
+               else
+                       range = false;
+
+               ret &= PALMAS_SMPS_VOLT_MASK;
+               ret = palmas_smps_hex2volt(ret, range);
+               if (ret < 0)
+                       return ret;
+               *uV = ret;
+
+               return 0;
+       }
+
+       hex = palmas_smps_volt2hex(*uV);
+       if (hex < 0)
+               return hex;
+
+       ret &= ~PALMAS_SMPS_VOLT_MASK;
+       ret |= hex;
+       if (*uV > 1650000)
+               ret |= PALMAS_SMPS_RANGE_MASK;
+
+       return pmic_reg_write(dev->parent, adr, ret);
+}
+
+static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable)
+{
+       int ret;
+       unsigned int adr;
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+       adr = uc_pdata->ctrl_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+               if (ret < 0)
+                       return ret;
+
+       if (op == PMIC_OP_GET) {
+               ret &= PALMAS_LDO_STATUS_MASK;
+
+               if (ret)
+                       *enable = true;
+               else
+                       *enable = false;
+
+               return 0;
+       } else if (op == PMIC_OP_SET) {
+               if (*enable)
+                       ret |= PALMAS_LDO_MODE_MASK;
+               else
+                       ret &= ~(PALMAS_LDO_MODE_MASK);
+
+               ret = pmic_reg_write(dev->parent, adr, ret);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
+static int palmas_ldo_volt2hex(int uV)
+{
+       if (uV > PALMAS_LDO_VOLT_MAX)
+               return -EINVAL;
+
+       return (uV - 850000) / 50000;
+}
+
+static int palmas_ldo_hex2volt(int hex)
+{
+       if (hex > PALMAS_LDO_VOLT_MAX_HEX)
+               return -EINVAL;
+
+       if (!hex)
+               return 0;
+
+       return (hex * 50000) + 850000;
+}
+
+static int palmas_ldo_val(struct udevice *dev, int op, int *uV)
+{
+       unsigned int hex, adr;
+       int ret;
+
+       struct dm_regulator_uclass_platdata *uc_pdata;
+
+       if (op == PMIC_OP_GET)
+               *uV = 0;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+
+       adr = uc_pdata->volt_reg;
+
+       ret = pmic_reg_read(dev->parent, adr);
+       if (ret < 0)
+               return ret;
+
+       if (op == PMIC_OP_GET) {
+               ret &= PALMAS_LDO_VOLT_MASK;
+               ret = palmas_ldo_hex2volt(ret);
+               if (ret < 0)
+                       return ret;
+               *uV = ret;
+               return 0;
+       }
+
+       hex = palmas_ldo_volt2hex(*uV);
+       if (hex < 0)
+               return hex;
+
+       ret &= ~PALMAS_LDO_VOLT_MASK;
+       ret |= hex;
+       if (*uV > 1650000)
+               ret |= 0x80;
+
+       return pmic_reg_write(dev->parent, adr, ret);
+}
+
+static int palmas_ldo_probe(struct udevice *dev)
+{
+       struct dm_regulator_uclass_platdata *uc_pdata;
+       struct udevice *parent;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+
+       parent = dev_get_parent(dev);
+       int type = dev_get_driver_data(parent);
+
+       uc_pdata->type = REGULATOR_TYPE_LDO;
+
+       if (dev->driver_data) {
+               u8 idx = dev->driver_data - 1;
+               uc_pdata->ctrl_reg = palmas_ldo_ctrl[type][idx];
+               uc_pdata->volt_reg = palmas_ldo_volt[type][idx];
+       } else {
+               /* check for ldoln and ldousb cases */
+               if (!strcmp("ldoln", dev->name)) {
+                       uc_pdata->ctrl_reg = palmas_ldo_ctrl[type][9];
+                       uc_pdata->volt_reg = palmas_ldo_volt[type][9];
+               } else if (!strcmp("ldousb", dev->name)) {
+                       uc_pdata->ctrl_reg = palmas_ldo_ctrl[type][10];
+                       uc_pdata->volt_reg = palmas_ldo_volt[type][10];
+               }
+       }
+
+       return 0;
+}
+
+static int ldo_get_value(struct udevice *dev)
+{
+       int uV;
+       int ret;
+
+       ret = palmas_ldo_val(dev, PMIC_OP_GET, &uV);
+       if (ret)
+               return ret;
+
+       return uV;
+}
+
+static int ldo_set_value(struct udevice *dev, int uV)
+{
+       return palmas_ldo_val(dev, PMIC_OP_SET, &uV);
+}
+
+static bool ldo_get_enable(struct udevice *dev)
+{
+       bool enable = false;
+       int ret;
+
+       ret = palmas_ldo_enable(dev, PMIC_OP_GET, &enable);
+       if (ret)
+               return ret;
+
+       return enable;
+}
+
+static int ldo_set_enable(struct udevice *dev, bool enable)
+{
+       return palmas_ldo_enable(dev, PMIC_OP_SET, &enable);
+}
+
+static int palmas_smps_probe(struct udevice *dev)
+{
+       struct dm_regulator_uclass_platdata *uc_pdata;
+       struct udevice *parent;
+       int idx;
+
+       uc_pdata = dev_get_uclass_platdata(dev);
+
+       parent = dev_get_parent(dev);
+       int type = dev_get_driver_data(parent);
+
+       uc_pdata->type = REGULATOR_TYPE_BUCK;
+
+       switch (type) {
+       case PALMAS:
+       case TPS659038:
+               switch (dev->driver_data) {
+               case 123:
+               case 12:
+                       uc_pdata->ctrl_reg = palmas_smps_ctrl[type][0];
+                       uc_pdata->volt_reg = palmas_smps_volt[type][0];
+                       break;
+               case 3:
+                       uc_pdata->ctrl_reg = palmas_smps_ctrl[type][1];
+                       uc_pdata->volt_reg = palmas_smps_volt[type][1];
+                       break;
+               case 45:
+                       uc_pdata->ctrl_reg = palmas_smps_ctrl[type][2];
+                       uc_pdata->volt_reg = palmas_smps_volt[type][2];
+                       break;
+               case 6:
+               case 7:
+               case 8:
+               case 9:
+               case 10:
+                       idx = dev->driver_data - 4;
+                       uc_pdata->ctrl_reg = palmas_smps_ctrl[type][idx];
+                       uc_pdata->volt_reg = palmas_smps_volt[type][idx];
+                       break;
+
+               default:
+                       printf("Wrong ID for regulator\n");
+               }
+               break;
+
+       case TPS65917:
+               switch (dev->driver_data) {
+               case 1:
+               case 2:
+               case 3:
+               case 4:
+               case 5:
+                       idx = dev->driver_data - 1;
+                       uc_pdata->ctrl_reg = palmas_smps_ctrl[type][idx];
+                       uc_pdata->volt_reg = palmas_smps_volt[type][idx];
+                       break;
+
+               default:
+                       printf("Wrong ID for regulator\n");
+               }
+               break;
+
+       default:
+                       printf("Invalid PMIC ID\n");
+       }
+
+       return 0;
+}
+
+static int smps_get_value(struct udevice *dev)
+{
+       int uV;
+       int ret;
+
+       ret = palmas_smps_val(dev, PMIC_OP_GET, &uV);
+       if (ret)
+               return ret;
+
+       return uV;
+}
+
+static int smps_set_value(struct udevice *dev, int uV)
+{
+       return palmas_smps_val(dev, PMIC_OP_SET, &uV);
+}
+
+static bool smps_get_enable(struct udevice *dev)
+{
+       bool enable = false;
+       int ret;
+
+       ret = palmas_smps_enable(dev, PMIC_OP_GET, &enable);
+       if (ret)
+               return ret;
+
+       return enable;
+}
+
+static int smps_set_enable(struct udevice *dev, bool enable)
+{
+       return palmas_smps_enable(dev, PMIC_OP_SET, &enable);
+}
+
+static const struct dm_regulator_ops palmas_ldo_ops = {
+       .get_value  = ldo_get_value,
+       .set_value  = ldo_set_value,
+       .get_enable = ldo_get_enable,
+       .set_enable = ldo_set_enable,
+};
+
+U_BOOT_DRIVER(palmas_ldo) = {
+       .name = PALMAS_LDO_DRIVER,
+       .id = UCLASS_REGULATOR,
+       .ops = &palmas_ldo_ops,
+       .probe = palmas_ldo_probe,
+};
+
+static const struct dm_regulator_ops palmas_smps_ops = {
+       .get_value  = smps_get_value,
+       .set_value  = smps_set_value,
+       .get_enable = smps_get_enable,
+       .set_enable = smps_set_enable,
+};
+
+U_BOOT_DRIVER(palmas_smps) = {
+       .name = PALMAS_SMPS_DRIVER,
+       .id = UCLASS_REGULATOR,
+       .ops = &palmas_smps_ops,
+       .probe = palmas_smps_probe,
+};
index 2703eed2088b44164d03c6ab5e4d6904c226e28a..cd10fd6845fbe46ee6802fff801342e6cdf814cf 100644 (file)
@@ -94,6 +94,7 @@ int sandbox_fs_ls(const char *dirname)
                printf("%s %10lu %s\n", os_dirent_get_typename(node->type),
                       node->size, node->name);
        }
+       os_dirent_free(head);
 
        return 0;
 }
index 30b19089b14dd96683901637cc46d12f13d24035..ec7517c5ae27adf2423a13f5acddf9a80b125810 100644 (file)
@@ -280,6 +280,17 @@ int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset,
 int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset,
                    uint32_t size);
 
+/**
+ * Read back flash parameters
+ *
+ * This function reads back parameters of the flash as reported by the EC
+ *
+ * @param dev  Pointer to device
+ * @param info Pointer to output flash info struct
+ */
+int cros_ec_read_flashinfo(struct cros_ec_dev *dev,
+                         struct ec_response_flash_info *info);
+
 /**
  * Write data to the flash
  *
index 5b9602cd05c4a627c16513c3721c8bb492dea731..4dda0091cefc1e7773213f3968e4ff8111b5b971 100644 (file)
@@ -253,14 +253,12 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg)
  * See rockchip_dw_mmc.c for an example.
  *
  * @cfg:       Configuration structure to fill in (generally &plat->mmc)
- * @name:      Device name (normally dev->name)
- * @buswidth:  Bus width (in bits, such as 4 or 8)
- * @caps:      Host capabilities (MMC_MODE_...)
+ * @host:      DWMMC host
  * @max_clk:   Maximum supported clock speed in HZ (e.g. 150000000)
  * @min_clk:   Minimum supported clock speed in HZ (e.g. 400000)
  */
-void dwmci_setup_cfg(struct mmc_config *cfg, const char *name, int buswidth,
-                    uint caps, u32 max_clk, u32 min_clk);
+void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host,
+               u32 max_clk, u32 min_clk);
 
 /**
  * dwmci_bind() - Set up a new MMC block device
index 1782e50e77511769b19b7a83679d5521107e5f8e..049b248c5b016fe59e050cac153300202b071889 100644 (file)
@@ -214,10 +214,19 @@ struct os_dirent_node {
  */
 int os_dirent_ls(const char *dirname, struct os_dirent_node **headp);
 
+/**
+ * Free directory list
+ *
+ * This frees a linked list containing a directory listing.
+ *
+ * @param node         Pointer to head of linked list
+ */
+void os_dirent_free(struct os_dirent_node *node);
+
 /**
  * Get the name of a directory entry type
  *
- * @param type         Type to cehck
+ * @param type         Type to check
  * @return string containing the name of that type, or "???" if none/invalid
  */
 const char *os_dirent_get_typename(enum os_dirent_t type);
diff --git a/include/power/lp873x.h b/include/power/lp873x.h
new file mode 100644 (file)
index 0000000..e0c0711
--- /dev/null
@@ -0,0 +1,19 @@
+#define        LP8732          0x0
+#define LP8733         0x1
+
+#define LP873X_LDO_NUM         2
+#define LP873X_BUCK_NUM                2
+
+/* Drivers name */
+#define LP873X_LDO_DRIVER      "lp873x_ldo"
+#define LP873X_BUCK_DRIVER     "lp873x_buck"
+
+#define LP873X_BUCK_VOLT_MASK          0xFF
+#define LP873X_BUCK_VOLT_MAX_HEX       0xFF
+#define LP873X_BUCK_VOLT_MAX           3360000
+#define LP873X_BUCK_MODE_MASK          0x1
+
+#define LP873X_LDO_VOLT_MASK    0x1F
+#define LP873X_LDO_VOLT_MAX_HEX 0x19
+#define LP873X_LDO_VOLT_MAX     3300000
+#define LP873X_LDO_MODE_MASK   0x1
diff --git a/include/power/palmas.h b/include/power/palmas.h
new file mode 100644 (file)
index 0000000..bad5a35
--- /dev/null
@@ -0,0 +1,25 @@
+#define        PALMAS          0x0
+#define TPS659038      0x1
+#define TPS65917       0x2
+
+/* I2C device address for pmic palmas */
+#define PALMAS_I2C_ADDR        (0x12 >> 1)
+#define PALMAS_LDO_NUM         11
+#define PALMAS_SMPS_NUM        8
+
+/* Drivers name */
+#define PALMAS_LDO_DRIVER     "palmas_ldo"
+#define PALMAS_SMPS_DRIVER    "palmas_smps"
+
+#define PALMAS_SMPS_VOLT_MASK          0x7F
+#define PALMAS_SMPS_RANGE_MASK         0x80
+#define PALMAS_SMPS_VOLT_MAX_HEX       0x7F
+#define PALMAS_SMPS_VOLT_MAX           3300000
+#define PALMAS_SMPS_MODE_MASK          0x3
+#define        PALMAS_SMPS_STATUS_MASK         0x30
+
+#define PALMAS_LDO_VOLT_MASK    0x3F
+#define PALMAS_LDO_VOLT_MAX_HEX 0x3F
+#define PALMAS_LDO_VOLT_MAX     3300000
+#define PALMAS_LDO_MODE_MASK   0x1
+#define PALMAS_LDO_STATUS_MASK 0x10
index 9bcd728120aa9a53b2f4d1a4ebe157539a7d1675..f47ab6740bdd6951056184b755831efe956d6ea6 100644 (file)
@@ -108,6 +108,7 @@ enum regulator_type {
        REGULATOR_TYPE_BUCK,
        REGULATOR_TYPE_DVS,
        REGULATOR_TYPE_FIXED,
+       REGULATOR_TYPE_GPIO,
        REGULATOR_TYPE_OTHER,
 };
 
@@ -152,6 +153,8 @@ enum regulator_flag {
  * TODO(sjg@chromium.org): Consider putting the above two into @flags
  * @flags:     - flags value (see REGULATOR_FLAG_...)
  * @name**     - fdt regulator name - should be taken from the device tree
+ * ctrl_reg:   - Control register offset used to enable/disable regulator
+ * volt_reg:   - register offset for writing voltage vsel values
  *
  * Note:
  * *  - set automatically on device probe by the uclass's '.pre_probe' method.
@@ -171,6 +174,8 @@ struct dm_regulator_uclass_platdata {
        bool boot_on;
        const char *name;
        int flags;
+       u8 ctrl_reg;
+       u8 volt_reg;
 };
 
 /* Regulator device operations */
index 8c5f8610d02f8c4c3145904bae05bb6bcd71f2c2..514bebc9f815b206b1c80c9918872d651277c98c 100644 (file)
@@ -211,6 +211,15 @@ arm: arm-none-eabi-
 
 and buildman will find arm-none-eabi-gcc in /usr/bin if you have it installed.
 
+[toolchain-wrapper]
+wrapper: ccache
+
+This tells buildman to use a compiler wrapper in front of CROSS_COMPILE. In
+this example, ccache. It doesn't affect the toolchain scan. The wrapper is
+added when CROSS_COMPILE environtal variable is set. The name in this
+section is ignored. If more than one line is provided, only the last one
+is taken.
+
 3. Make sure you have the require Python pre-requisites
 
 Buildman uses multiprocessing, Queue, shutil, StringIO, ConfigParser and
index 8ec3551729015ed7a6b2a3cb9bea134251ced4f6..e27a28577c2547a134acf65f392b05668137d0da 100644 (file)
@@ -12,8 +12,10 @@ import os
 import re
 import Queue
 import shutil
+import signal
 import string
 import sys
+import threading
 import time
 
 import builderthread
@@ -126,7 +128,6 @@ class Builder:
     """Class for building U-Boot for a particular commit.
 
     Public members: (many should ->private)
-        active: True if the builder is active and has not been stopped
         already_done: Number of builds already completed
         base_dir: Base directory to use for builder
         checkout: True to check out source, False to skip that step.
@@ -234,7 +235,6 @@ class Builder:
         self.base_dir = base_dir
         self._working_dir = os.path.join(base_dir, '.bm-work')
         self.threads = []
-        self.active = True
         self.do_make = self.Make
         self.gnu_make = gnu_make
         self.checkout = checkout
@@ -283,11 +283,17 @@ class Builder:
         ignore_lines = ['(make.*Waiting for unfinished)', '(Segmentation fault)']
         self.re_make_err = re.compile('|'.join(ignore_lines))
 
+        # Handle existing graceful with SIGINT / Ctrl-C
+        signal.signal(signal.SIGINT, self.signal_handler)
+
     def __del__(self):
         """Get rid of all threads created by the builder"""
         for t in self.threads:
             del t
 
+    def signal_handler(self, signal, frame):
+        sys.exit(1)
+
     def SetDisplayOptions(self, show_errors=False, show_sizes=False,
                           show_detail=False, show_bloat=False,
                           list_error_boards=False, show_config=False):
@@ -389,11 +395,6 @@ class Builder:
         if result:
             target = result.brd.target
 
-            if result.return_code < 0:
-                self.active = False
-                command.StopAll()
-                return
-
             self.upto += 1
             if result.return_code != 0:
                 self.fail += 1
@@ -1366,8 +1367,10 @@ class Builder:
             if os.path.exists(git_dir):
                 gitutil.Fetch(git_dir, thread_dir)
             else:
-                Print('Cloning repo for thread %d' % thread_num)
+                Print('\rCloning repo for thread %d' % thread_num,
+                      newline=False)
                 gitutil.Clone(src_dir, thread_dir)
+                Print('\r%s\r' % (' ' * 30), newline=False)
 
     def _PrepareWorkingSpace(self, max_threads, setup_git):
         """Prepare the working directory for use.
@@ -1395,8 +1398,14 @@ class Builder:
         for commit_upto in range(self.commit_count):
             dir_list.append(self._GetOutputDir(commit_upto))
 
+        to_remove = []
         for dirname in glob.glob(os.path.join(self.base_dir, '*')):
             if dirname not in dir_list:
+                to_remove.append(dirname)
+        if to_remove:
+            Print('Removing %d old build directories' % len(to_remove),
+                  newline=False)
+            for dirname in to_remove:
                 shutil.rmtree(dirname)
 
     def BuildBoards(self, commits, board_selected, keep_outputs, verbose):
@@ -1422,6 +1431,7 @@ class Builder:
         self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)),
                 commits is not None)
         self._PrepareOutputSpace()
+        Print('\rStarting build...', newline=False)
         self.SetupBuild(board_selected, commits)
         self.ProcessResult(None)
 
@@ -1434,8 +1444,11 @@ class Builder:
             job.step = self._step
             self.queue.put(job)
 
-        # Wait until all jobs are started
-        self.queue.join()
+        term = threading.Thread(target=self.queue.join)
+        term.setDaemon(True)
+        term.start()
+        while term.isAlive():
+            term.join(100)
 
         # Wait until we have processed all output
         self.out_queue.join()
index c512d3b521f755d0945030e4cb6cc958170c24a9..8974351225ce6ace5f6082901da3bdd005681118 100644 (file)
@@ -304,10 +304,6 @@ class BuilderThread(threading.Thread):
                 print >>fd, 'arch', result.toolchain.arch
                 fd.write('%s' % result.return_code)
 
-            with open(os.path.join(build_dir, 'toolchain'), 'w') as fd:
-                print >>fd, 'gcc', result.toolchain.gcc
-                print >>fd, 'path', result.toolchain.path
-
             # Write out the image and function size information and an objdump
             env = result.toolchain.MakeEnvironment(self.builder.full_path)
             lines = []
@@ -470,17 +466,7 @@ class BuilderThread(threading.Thread):
         This thread picks a job from the queue, runs it, and then goes to the
         next job.
         """
-        alive = True
         while True:
             job = self.builder.queue.get()
-            if self.builder.active and alive:
-                self.RunJob(job)
-            '''
-            try:
-                if self.builder.active and alive:
-                    self.RunJob(job)
-            except Exception as err:
-                alive = False
-                print err
-            '''
+            self.RunJob(job)
             self.builder.queue.task_done()
index d0afeda6c07734a7d7505757a437818a3ed25df7..607429df7bcd9fb045e30ce1fa81a6cba318110d 100755 (executable)
@@ -15,7 +15,7 @@ import unittest
 
 # Bring in the patman libraries
 our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../patman'))
+sys.path.insert(1, os.path.join(our_path, '../patman'))
 
 # Our modules
 import board
index d8f3c81fadf9345f6ffbec9dad86257a2dca8b76..ed2a3a8929bb4af9ca364f5971e8c97412980d2f 100644 (file)
@@ -198,9 +198,9 @@ class TestBuild(unittest.TestCase):
             if line.text.strip():
                 count += 1
 
-        # We should get one starting message, then an update for every commit
+        # We should get two starting messages, then an update for every commit
         # built.
-        self.assertEqual(count, len(commits) * len(boards) + 1)
+        self.assertEqual(count, len(commits) * len(boards) + 2)
         build.SetDisplayOptions(show_errors=True);
         build.ShowSummary(self.commits, board_selected)
         #terminal.EchoPrintTestLines()
index 41e4e4c5350e8159748ea27be84111055fa5c6cc..47788762016b1026b31890c59619a63a18807b62 100644 (file)
@@ -127,6 +127,18 @@ class Toolchain:
                 return PRIORITY_CALC + prio
         return PRIORITY_CALC + prio
 
+    def GetWrapper(self, show_warning=True):
+        """Get toolchain wrapper from the setting file.
+        """
+       value = ''
+       for name, value in bsettings.GetItems('toolchain-wrapper'):
+            if not value:
+                print "Warning: Wrapper not found"
+        if value:
+            value = value + ' '
+
+        return value
+
     def MakeEnvironment(self, full_path):
         """Returns an environment for using the toolchain.
 
@@ -138,10 +150,12 @@ class Toolchain:
                 PATH
         """
         env = dict(os.environ)
+        wrapper = self.GetWrapper()
+
         if full_path:
-            env['CROSS_COMPILE'] = os.path.join(self.path, self.cross)
+            env['CROSS_COMPILE'] = wrapper + os.path.join(self.path, self.cross)
         else:
-            env['CROSS_COMPILE'] = self.cross
+            env['CROSS_COMPILE'] = wrapper + self.cross
             env['PATH'] = self.path + ':' + env['PATH']
 
         return env
index 518aa512169752e487b68d85d3b4585f289df085..11050b66f71057821f0a2076fcbba0a4ad6f734e 100755 (executable)
@@ -60,7 +60,7 @@ def Conv_name_to_c(name):
 def TabTo(num_tabs, str):
     if len(str) >= num_tabs * 8:
         return str + ' '
-    return str + '\t' * (num_tabs - len(str) / 8)
+    return str + '\t' * (num_tabs - len(str) // 8)
 
 class DtbPlatdata:
     """Provide a means to convert device tree binary data to platform data
@@ -224,14 +224,14 @@ class DtbPlatdata:
             fields = {}
 
             # Get a list of all the valid properties in this node.
-            for name, prop in node.props.iteritems():
+            for name, prop in node.props.items():
                 if name not in PROP_IGNORE_LIST and name[0] != '#':
                     fields[name] = copy.deepcopy(prop)
 
             # If we've seen this node_name before, update the existing struct.
             if node_name in structs:
                 struct = structs[node_name]
-                for name, prop in fields.iteritems():
+                for name, prop in fields.items():
                     oldprop = struct.get(name)
                     if oldprop:
                         oldprop.Widen(prop)
@@ -246,7 +246,7 @@ class DtbPlatdata:
         for node in self._valid_nodes:
             node_name = self.GetCompatName(node)
             struct = structs[node_name]
-            for name, prop in node.props.iteritems():
+            for name, prop in node.props.items():
                 if name not in PROP_IGNORE_LIST and name[0] != '#':
                     prop.Widen(struct[name])
             upto += 1
@@ -298,7 +298,7 @@ class DtbPlatdata:
             var_name = Conv_name_to_c(node.name)
             self.Buf('static struct %s%s %s%s = {\n' %
                 (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
-            for pname, prop in node.props.iteritems():
+            for pname, prop in node.props.items():
                 if pname in PROP_IGNORE_LIST or pname[0] == '#':
                     continue
                 ptype = TYPE_NAMES[prop.type]
index 0c0ebbcf47a1217f42bebc529a69e76367cf9c5b..23e26796c8fff84079870b0b5ad22dcb9c0316c5 100644 (file)
@@ -58,7 +58,7 @@ class Node(NodeBase):
         This fills in the props and subnodes properties, recursively
         searching into subnodes so that the entire tree is built.
         """
-        for name, byte_list_str in self._fdt.GetProps(self.path).iteritems():
+        for name, byte_list_str in self._fdt.GetProps(self.path).items():
             prop = Prop(self, name, byte_list_str)
             self.props[name] = prop
 
@@ -160,7 +160,7 @@ class FdtFallback(Fdt):
         if default is not None:
           args += ['-d', str(default)]
         if typespec is not None:
-          args += ['-t%s' % typespec]
+          args += ['-t', typespec]
         out = command.Output('fdtget', *args)
         return out.strip()
 
index aae258e4128accd2095798664861a666856cdcd4..cce5c06d8c15a677fbd84468f74f3516673cc82a 100644 (file)
@@ -81,7 +81,7 @@ class Node(NodeBase):
         This fills in the props and subnodes properties, recursively
         searching into subnodes so that the entire tree is built.
         """
-        self.props = self._fdt.GetProps(self, self.path)
+        self.props = self._fdt.GetProps(self)
 
         offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset())
         while offset >= 0:
@@ -159,7 +159,7 @@ class FdtNormal(Fdt):
         fdt_len = libfdt.fdt_totalsize(self._fdt)
         del self._fdt[fdt_len:]
 
-    def GetProps(self, node, path):
+    def GetProps(self, node):
         """Get all properties from a node.
 
         Args:
@@ -172,11 +172,8 @@ class FdtNormal(Fdt):
         Raises:
             ValueError: if the node does not exist.
         """
-        offset = libfdt.fdt_path_offset(self._fdt, path)
-        if offset < 0:
-            libfdt.Raise(offset)
         props_dict = {}
-        poffset = libfdt.fdt_first_property_offset(self._fdt, offset)
+        poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset)
         while poffset >= 0:
             dprop, plen = libfdt.fdt_get_property_by_offset(self._fdt, poffset)
             prop = Prop(node, poffset, libfdt.String(self._fdt, dprop.nameoff),
index 18a36d88a0250cc79efc3b9a36e700b77b58b6bb..ea78c527fc1e0faa02d28420a7bb1dbe1175199c 100644 (file)
@@ -6,6 +6,8 @@
 # SPDX-License-Identifier:      GPL-2.0+
 #
 
+import fdt_fallback
+
 # Bring in either the normal fdt library (which relies on libfdt) or the
 # fallback one (which uses fdtget and is slower). Both provide the same
 # interface for this file to use.
@@ -14,13 +16,21 @@ try:
     have_libfdt = True
 except ImportError:
     have_libfdt = False
-    import fdt_fallback
 
-def FdtScan(fname):
+force_fallback = False
+
+def FdtScan(fname, _force_fallback=False):
     """Returns a new Fdt object from the implementation we are using"""
-    if have_libfdt:
+    if have_libfdt and not force_fallback and not _force_fallback:
         dtb = fdt_normal.FdtNormal(fname)
     else:
         dtb = fdt_fallback.FdtFallback(fname)
     dtb.Scan()
     return dtb
+
+def UseFallback(fallback):
+    global force_fallback
+
+    old_val = force_fallback
+    force_fallback = fallback
+    return old_val
index 3a108381099e613a81fdf62e2f4727b8fb034b31..e6d523b9de65699ec08ebf863b1e614699d16b9c 100644 (file)
@@ -8,6 +8,7 @@
 
 import os
 import struct
+import sys
 import tempfile
 
 import command
@@ -22,6 +23,8 @@ def fdt32_to_cpu(val):
     Return:
         A native-endian integer value
     """
+    if sys.version_info > (3, 0):
+        val = val.encode('raw_unicode_escape')
     return struct.unpack('>I', val)[0]
 
 def EnsureCompiled(fname):
index 3eef6de221062894d2a4c5551c2009e68fed7d00..be78fc510b8aa0341d26f77ef4c56df881d53a79 100644 (file)
@@ -83,7 +83,7 @@ def CheckPatch(fname, verbose=False):
 
     for line in result.stdout.splitlines():
         if verbose:
-            print line
+            print(line)
 
         # A blank line indicates the end of a message
         if not line and item:
@@ -151,17 +151,17 @@ def CheckPatches(verbose, args):
             error_count += result.errors
             warning_count += result.warnings
             check_count += result.checks
-            print '%d errors, %d warnings, %d checks for %s:' % (result.errors,
-                    result.warnings, result.checks, col.Color(col.BLUE, fname))
+            print('%d errors, %d warnings, %d checks for %s:' % (result.errors,
+                    result.warnings, result.checks, col.Color(col.BLUE, fname)))
             if (len(result.problems) != result.errors + result.warnings +
                     result.checks):
-                print "Internal error: some problems lost"
+                print("Internal error: some problems lost")
             for item in result.problems:
-                print GetWarningMsg(col, item.get('type', '<unknown>'),
+                print(GetWarningMsg(col, item.get('type', '<unknown>'),
                         item.get('file', '<unknown>'),
-                        item.get('line', 0), item.get('msg', 'message'))
+                        item.get('line', 0), item.get('msg', 'message')))
             print
-            #print stdout
+            #print(stdout)
     if error_count or warning_count or check_count:
         str = 'checkpatch.pl found %d error(s), %d warning(s), %d checks(s)'
         color = col.GREEN
@@ -169,6 +169,6 @@ def CheckPatches(verbose, args):
             color = col.YELLOW
         if error_count:
             color = col.RED
-        print col.Color(color, str % (error_count, warning_count, check_count))
+        print(col.Color(color, str % (error_count, warning_count, check_count)))
         return False
     return True
index d1f0ca505c07f389e3abe0d5e76405b27035f605..bebc495b5994e2bc7e5c3f7a856a24166581f42f 100644 (file)
@@ -85,7 +85,7 @@ def RunPipe(pipe_list, infile=None, outfile=None,
 
         try:
             last_pipe = cros_subprocess.Popen(cmd, cwd=cwd, **kwargs)
-        except Exception, err:
+        except Exception as err:
             result.exception = err
             if raise_on_error:
                 raise Exception("Error running '%s': %s" % (user_pipestr, str))
index 0fc4a06b5066af43b4207e58d4c9ec33d3e43044..ebd4300dfd5728d6f5ff52b360d8d8d5be629687 100644 (file)
@@ -166,7 +166,7 @@ class Popen(subprocess.Popen):
         while read_set or write_set:
             try:
                 rlist, wlist, _ = select.select(read_set, write_set, [], 0.2)
-            except select.error, e:
+            except select.error as e:
                 if e.args[0] == errno.EINTR:
                     continue
                 raise
index 00b49394bc5ef87ca72c2075546c330a883cb8c7..2deb5db6ecff7bcfc9c4ba3da5905eb6d7e36476 100644 (file)
@@ -40,7 +40,7 @@ def GetMaintainer(fname, verbose=False):
     get_maintainer = FindGetMaintainer()
     if not get_maintainer:
         if verbose:
-            print "WARNING: Couldn't find get_maintainer.pl"
+            print("WARNING: Couldn't find get_maintainer.pl")
         return []
 
     stdout = command.Output(get_maintainer, '--norolestats', fname)
index bb7c9e08bc2c3a50a4b9a6435e1fa345a9c5f651..0d23079a3ab1b4a0fd62d6ec3a5c4323c877fbe7 100644 (file)
@@ -139,7 +139,7 @@ def GetUpstream(git_dir, branch):
         leaf = merge.split('/')[-1]
         return '%s/%s' % (remote, leaf), None
     else:
-        raise ValueError("Cannot determine upstream branch for branch "
+        raise ValueError("Cannot determine upstream branch for branch "
                 "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
 
 
@@ -224,7 +224,7 @@ def Checkout(commit_hash, git_dir=None, work_tree=None, force=False):
     result = command.RunPipe([pipe], capture=True, raise_on_error=False,
                              capture_stderr=True)
     if result.return_code != 0:
-        raise OSError, 'git checkout (%s): %s' % (pipe, result.stderr)
+        raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
 
 def Clone(git_dir, output_dir):
     """Checkout the selected commit for this build
@@ -236,7 +236,7 @@ def Clone(git_dir, output_dir):
     result = command.RunPipe([pipe], capture=True, cwd=output_dir,
                              capture_stderr=True)
     if result.return_code != 0:
-        raise OSError, 'git clone: %s' % result.stderr
+        raise OSError('git clone: %s' % result.stderr)
 
 def Fetch(git_dir=None, work_tree=None):
     """Fetch from the origin repo
@@ -252,7 +252,7 @@ def Fetch(git_dir=None, work_tree=None):
     pipe.append('fetch')
     result = command.RunPipe([pipe], capture=True, capture_stderr=True)
     if result.return_code != 0:
-        raise OSError, 'git fetch: %s' % result.stderr
+        raise OSError('git fetch: %s' % result.stderr)
 
 def CreatePatches(start, count, series):
     """Create a series of patches from the top of the current branch.
@@ -489,18 +489,18 @@ def LookupEmail(lookup_name, alias=None, raise_on_error=True, level=0):
     if level > 10:
         msg = "Recursive email alias at '%s'" % lookup_name
         if raise_on_error:
-            raise OSError, msg
+            raise OSError(msg)
         else:
-            print col.Color(col.RED, msg)
+            print(col.Color(col.RED, msg))
             return out_list
 
     if lookup_name:
         if not lookup_name in alias:
             msg = "Alias '%s' not found" % lookup_name
             if raise_on_error:
-                raise ValueError, msg
+                raise ValueError(msg)
             else:
-                print col.Color(col.RED, msg)
+                print(col.Color(col.RED, msg))
                 return out_list
         for item in alias[lookup_name]:
             todo = LookupEmail(item, alias, raise_on_error, level + 1)
@@ -508,7 +508,7 @@ def LookupEmail(lookup_name, alias=None, raise_on_error=True, level=0):
                 if not new_item in out_list:
                     out_list.append(new_item)
 
-    #print "No match for alias '%s'" % lookup_name
+    #print("No match for alias '%s'" % lookup_name)
     return out_list
 
 def GetTopLevel():
index 69d5cfb7a8ea8fc66572180d02334e5a8b7d8654..cd4667f61ce712399f46ae18c6d21dc470fa0b00 100644 (file)
@@ -480,12 +480,12 @@ def FixPatches(series, fnames):
         commit.patch = fname
         result = FixPatch(backup_dir, fname, series, commit)
         if result:
-            print '%d warnings for %s:' % (len(result), fname)
+            print('%d warnings for %s:' % (len(result), fname))
             for warn in result:
-                print '\t', warn
+                print('\t', warn)
             print
         count += 1
-    print 'Cleaned %d patches' % count
+    print('Cleaned %d patches' % count)
     return series
 
 def InsertCoverLetter(fname, series, count):
index fe50eb4d5c8322b9b4a07a767a44c05523f614b8..fdbee67f559bc94becc9d8ac447871853ec4a52f 100755 (executable)
@@ -93,11 +93,11 @@ elif options.test:
         suite.run(result)
 
     # TODO: Surely we can just 'print' result?
-    print result
+    print(result)
     for test, err in result.errors:
-        print err
+        print(err)
     for test, err in result.failures:
-        print err
+        print(err)
 
 # Called from git with a patch filename as argument
 # Printout a list of additional CC recipients for this patch
@@ -110,7 +110,7 @@ elif options.cc_cmd:
             for cc in match.group(2).split(', '):
                 cc = cc.strip()
                 if cc:
-                    print cc
+                    print(cc)
     fd.close()
 
 elif options.full_help:
@@ -166,12 +166,12 @@ else:
                 options.dry_run, not options.ignore_bad_tags, cc_file,
                 in_reply_to=options.in_reply_to, thread=options.thread)
     else:
-        print col.Color(col.RED, "Not sending emails due to errors/warnings")
+        print(col.Color(col.RED, "Not sending emails due to errors/warnings"))
 
     # For a dry run, just show our actions as a sanity check
     if options.dry_run:
         series.ShowActions(args, cmd, options.process_tags)
         if not its_a_go:
-            print col.Color(col.RED, "Email would not be sent")
+            print(col.Color(col.RED, "Email would not be sent"))
 
     os.remove(cc_file)
index cc6f80b2fd4e4dd917c45c5576979cbb4d2e9964..38a452edad4108e54527e8849cbcb27488031821 100644 (file)
@@ -3,6 +3,8 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
+from __future__ import print_function
+
 import itertools
 import os
 
@@ -101,38 +103,38 @@ class Series(dict):
         cc_set = set(gitutil.BuildEmailList(self.cc));
 
         col = terminal.Color()
-        print 'Dry run, so not doing much. But I would do this:'
-        print
-        print 'Send a total of %d patch%s with %scover letter.' % (
+        print('Dry run, so not doing much. But I would do this:')
+        print()
+        print('Send a total of %d patch%s with %scover letter.' % (
                 len(args), '' if len(args) == 1 else 'es',
-                self.get('cover') and 'a ' or 'no ')
+                self.get('cover') and 'a ' or 'no '))
 
         # TODO: Colour the patches according to whether they passed checks
         for upto in range(len(args)):
             commit = self.commits[upto]
-            print col.Color(col.GREEN, '   %s' % args[upto])
+            print(col.Color(col.GREEN, '   %s' % args[upto]))
             cc_list = list(self._generated_cc[commit.patch])
             for email in set(cc_list) - to_set - cc_set:
                 if email == None:
                     email = col.Color(col.YELLOW, "<alias '%s' not found>"
                             % tag)
                 if email:
-                    print '      Cc: ',email
+                    print('      Cc: ', email)
         print
         for item in to_set:
-            print 'To:\t ', item
+            print('To:\t ', item)
         for item in cc_set - to_set:
-            print 'Cc:\t ', item
-        print 'Version: ', self.get('version')
-        print 'Prefix:\t ', self.get('prefix')
+            print('Cc:\t ', item)
+        print('Version: ', self.get('version'))
+        print('Prefix:\t ', self.get('prefix'))
         if self.cover:
-            print 'Cover: %d lines' % len(self.cover)
+            print('Cover: %d lines' % len(self.cover))
             cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
             all_ccs = itertools.chain(cover_cc, *self._generated_cc.values())
             for email in set(all_ccs) - to_set - cc_set:
-                    print '      Cc: ',email
+                    print('      Cc: ', email)
         if cmd:
-            print 'Git command: %s' % cmd
+            print('Git command: %s' % cmd)
 
     def MakeChangeLog(self, commit):
         """Create a list of changes for each version.
@@ -191,13 +193,13 @@ class Series(dict):
                 else:
                     if version > 1:
                         str = 'Change log missing for v%d' % version
-                        print col.Color(col.RED, str)
+                        print(col.Color(col.RED, str))
             for version in changes_copy:
                 str = 'Change log for unknown version v%d' % version
-                print col.Color(col.RED, str)
+                print(col.Color(col.RED, str))
         elif self.changes:
             str = 'Change log exists, but no version is set'
-            print col.Color(col.RED, str)
+            print(col.Color(col.RED, str))
 
     def MakeCcFile(self, process_tags, cover_fname, raise_on_error,
                    add_maintainers):
@@ -225,15 +227,15 @@ class Series(dict):
                                                raise_on_error=raise_on_error)
             list += gitutil.BuildEmailList(commit.cc_list,
                                            raise_on_error=raise_on_error)
-           if add_maintainers:
+            if add_maintainers:
                 list += get_maintainer.GetMaintainer(commit.patch)
             all_ccs += list
-            print >>fd, commit.patch, ', '.join(set(list))
+            print(commit.patch, ', '.join(set(list)), file=fd)
             self._generated_cc[commit.patch] = list
 
         if cover_fname:
             cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
-            print >>fd, cover_fname, ', '.join(set(cover_cc + all_ccs))
+            print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)
 
         fd.close()
         return fname
@@ -259,7 +261,7 @@ class Series(dict):
         """
         git_prefix = gitutil.GetDefaultSubjectPrefix()
         if git_prefix:
-           git_prefix = '%s][' % git_prefix
+            git_prefix = '%s][' % git_prefix
         else:
             git_prefix = ''
 
index ba2a68ff63fcb6060f9516134cd9db99352faa8e..5f207f5ef1c476fd522faebb4962a23c85399c2d 100644 (file)
@@ -3,7 +3,13 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-import ConfigParser
+from __future__ import print_function
+
+try:
+    import configparser as ConfigParser
+except:
+    import ConfigParser
+
 import os
 import re
 
@@ -30,7 +36,10 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
     - Merge general default settings/aliases with project-specific ones.
 
     # Sample config used for tests below...
-    >>> import StringIO
+    >>> try:
+    ...     from StringIO import StringIO
+    ... except ImportError:
+    ...     from io import StringIO
     >>> sample_config = '''
     ... [alias]
     ... me: Peter P. <likesspiders@example.com>
@@ -48,25 +57,25 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 
     # Check to make sure that bogus project gets general alias.
     >>> config = _ProjectConfigParser("zzz")
-    >>> config.readfp(StringIO.StringIO(sample_config))
+    >>> config.readfp(StringIO(sample_config))
     >>> config.get("alias", "enemies")
     'Evil <evil@example.com>'
 
     # Check to make sure that alias gets overridden by project.
     >>> config = _ProjectConfigParser("sm")
-    >>> config.readfp(StringIO.StringIO(sample_config))
+    >>> config.readfp(StringIO(sample_config))
     >>> config.get("alias", "enemies")
     'Green G. <ugly@example.com>'
 
     # Check to make sure that settings get merged with project.
     >>> config = _ProjectConfigParser("linux")
-    >>> config.readfp(StringIO.StringIO(sample_config))
+    >>> config.readfp(StringIO(sample_config))
     >>> sorted(config.items("settings"))
     [('am_hero', 'True'), ('process_tags', 'False')]
 
     # Check to make sure that settings works with unknown project.
     >>> config = _ProjectConfigParser("unknown")
-    >>> config.readfp(StringIO.StringIO(sample_config))
+    >>> config.readfp(StringIO(sample_config))
     >>> sorted(config.items("settings"))
     [('am_hero', 'True')]
     """
@@ -88,7 +97,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
         if not self.has_section(project_settings):
             self.add_section(project_settings)
         project_defaults = _default_settings.get(project_name, {})
-        for setting_name, setting_value in project_defaults.iteritems():
+        for setting_name, setting_value in project_defaults.items():
             self.set(project_settings, setting_name, setting_value)
 
     def get(self, section, option, *args, **kwargs):
@@ -156,7 +165,7 @@ def ReadGitAliases(fname):
     try:
         fd = open(fname, 'r')
     except IOError:
-        print "Warning: Cannot find alias file '%s'" % fname
+        print("Warning: Cannot find alias file '%s'" % fname)
         return
 
     re_line = re.compile('alias\s+(\S+)\s+(.*)')
@@ -167,7 +176,7 @@ def ReadGitAliases(fname):
 
         m = re_line.match(line)
         if not m:
-            print "Warning: Alias file line '%s' not understood" % line
+            print("Warning: Alias file line '%s' not understood" % line)
             continue
 
         list = alias.get(m.group(1), [])
@@ -200,10 +209,10 @@ def CreatePatmanConfigFile(config_fname):
     try:
         f = open(config_fname, 'w')
     except IOError:
-        print "Couldn't create patman config file\n"
+        print("Couldn't create patman config file\n")
         raise
 
-    print >>f, "[alias]\nme: %s <%s>" % (name, email)
+    print("[alias]\nme: %s <%s>" % (name, email), file=f)
     f.close();
 
 def _UpdateDefaults(parser, config):
@@ -233,7 +242,7 @@ def _UpdateDefaults(parser, config):
                 val = config.getint('settings', name)
             parser.set_default(name, val)
         else:
-            print "WARNING: Unknown setting %s" % name
+            print("WARNING: Unknown setting %s" % name)
 
 def _ReadAliasFile(fname):
     """Read in the U-Boot git alias file if it exists.
@@ -258,7 +267,7 @@ def _ReadAliasFile(fname):
                     continue
                 alias[words[1]] = [s.strip() for s in words[2].split(',')]
         if bad_line:
-            print bad_line
+            print(bad_line)
 
 def Setup(parser, project_name, config_fname=''):
     """Set up the settings module by reading config files.
@@ -276,7 +285,7 @@ def Setup(parser, project_name, config_fname=''):
         config_fname = '%s/.patman' % os.getenv('HOME')
 
     if not os.path.exists(config_fname):
-        print "No config file found ~/.patman\nCreating one...\n"
+        print("No config file found ~/.patman\nCreating one...\n")
         CreatePatmanConfigFile(config_fname)
 
     config.read(config_fname)
index e78a7c14f5bfd87f9d7344d9c3ada90d1df973b5..137265fc81541ebb77726cce41e17c771fd9126d 100644 (file)
@@ -8,6 +8,8 @@
 This module handles terminal interaction including ANSI color codes.
 """
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -52,9 +54,11 @@ def Print(text='', newline=True, colour=None):
         if colour:
             col = Color()
             text = col.Color(colour, text)
-        print text,
+        print(text, end='')
         if newline:
-            print
+            print()
+        else:
+            sys.stdout.flush()
 
 def SetPrintTestMode():
     """Go into test mode, where all printing is recorded"""
@@ -79,11 +83,11 @@ def EchoPrintTestLines():
     for line in print_test_list:
         if line.colour:
             col = Color()
-            print col.Color(line.colour, line.text),
+            print(col.Color(line.colour, line.text), end='')
         else:
-            print line.text,
+            print(line.text, end='')
         if line.newline:
-            print
+            print()
 
 
 class Color(object):
index e8f7472785fb5704fb5df8da85d3758163f9686c..8c39f66e73089b892311b9e5655e48831f5a7a10 100644 (file)
@@ -181,7 +181,7 @@ index 0000000..2234c87
         elif data_type == 'indent':
             indent = tab
         else:
-            print 'not implemented'
+            print('not implemented')
         return data % (signoff, tab, indent, tab)
 
     def SetupData(self, data_type):