summaryrefslogtreecommitdiff
path: root/util/comm-lpc.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2016-04-13 12:34:08 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-15 13:40:17 -0700
commitde45353bbdf0c6c4afb88420d3cb2e182eae7450 (patch)
treec8679091de030c771b515fc96ac2b5c2e35fe14a /util/comm-lpc.c
parentfef9abf3b3473dad728e2f2bd8557e230214f03d (diff)
downloadchrome-ec-de45353bbdf0c6c4afb88420d3cb2e182eae7450.tar.gz
ectool: Remove CROS_EC_DEV_IOCRDMEM
On !LPC EC, we can read memory via CROS_EC_DEV_IOCXCMD ioctl, using command EC_CMD_READ_MEMMAP. On platform that supports direct memory access (lpc), we access the memory directly, bypassing the ioctl. BUG=chromium:602832 TEST=On gnawty and veyron, check 'ectool battery' works. Verify that gnawty use io mapped registers. BRANCH=none Change-Id: I9bfcddcf450bf8df63ead78e1df97dd7392289e6 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/338853 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util/comm-lpc.c')
-rw-r--r--util/comm-lpc.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/util/comm-lpc.c b/util/comm-lpc.c
index 54f16b3ffc..27a32f3b69 100644
--- a/util/comm-lpc.c
+++ b/util/comm-lpc.c
@@ -246,7 +246,7 @@ static int ec_readmem_lpc(int offset, int bytes, void *dest)
return cnt;
}
-int comm_init_lpc(void)
+int comm_init_lpc(int init_readmem_only)
{
int i;
int byte = 0xff;
@@ -257,6 +257,13 @@ int comm_init_lpc(void)
return -3;
}
+ ec_readmem = ec_readmem_lpc;
+
+ if (init_readmem_only) {
+ /* Function to send commands already defined. */
+ return 0;
+ }
+
/*
* Test if the I/O port has been configured for Chromium EC LPC
* interface. Chromium EC guarantees that at least one status bit will
@@ -308,9 +315,13 @@ int comm_init_lpc(void)
return -5;
}
- /* Either one supports reading mapped memory directly. */
- ec_readmem = ec_readmem_lpc;
return 0;
}
-#endif
+#else /* defined(__i386__) || defined(__x86_64__) */
+#include <errno.h>
+int comm_init_lpc(int unused)
+{
+ return -EOPNOTSUPP;
+}
+#endif /* defined(__i386__) || defined(__x86_64__) */