mtd: sf: Make sf_mtd.c more robust
[platform/kernel/u-boot.git] / drivers / misc / cros_ec_sandbox.c
index c96e26e..d741554 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Chromium OS cros_ec driver - sandbox emulation
  *
  * Copyright (c) 2013 The Chromium OS Authors.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -51,8 +50,6 @@
  * the EC image in with U-Boot (Vic has demonstrated a prototype for this).
  */
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define KEYBOARD_ROWS  8
 #define KEYBOARD_COLS  13
 
@@ -197,7 +194,7 @@ static int keyscan_read_fdt_matrix(struct ec_state *ec, ofnode node)
        int upto;
        int len;
 
-       cell = ofnode_read_prop(node, "linux,keymap", &len);
+       cell = ofnode_get_property(node, "linux,keymap", &len);
        ec->matrix_count = len / 4;
        ec->matrix = calloc(ec->matrix_count, sizeof(*ec->matrix));
        if (!ec->matrix) {
@@ -368,7 +365,7 @@ static int process_cmd(struct ec_state *ec,
                struct fmap_entry *entry;
                int ret, size;
 
-               entry = &ec->ec_config.region[EC_FLASH_REGION_RW];
+               entry = &ec->ec_config.region[EC_FLASH_REGION_ACTIVE];
 
                switch (req->cmd) {
                case EC_VBOOT_HASH_RECALC:
@@ -423,7 +420,7 @@ static int process_cmd(struct ec_state *ec,
 
                switch (req->region) {
                case EC_FLASH_REGION_RO:
-               case EC_FLASH_REGION_RW:
+               case EC_FLASH_REGION_ACTIVE:
                case EC_FLASH_REGION_WP_RO:
                        entry = &ec->ec_config.region[req->region];
                        resp->offset = entry->offset;
@@ -494,9 +491,9 @@ int cros_ec_sandbox_packet(struct udevice *udev, int out_bytes, int in_bytes)
        return in_bytes;
 }
 
-void cros_ec_check_keyboard(struct cros_ec_dev *dev)
+void cros_ec_check_keyboard(struct udevice *dev)
 {
-       struct ec_state *ec = dev_get_priv(dev->dev);
+       struct ec_state *ec = dev_get_priv(dev);
        ulong start;
 
        printf("Press keys for EC to detect on reset (ESC=recovery)...");