mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 18:35:28 +00:00
Cr50: Add "wp" console command to control EC_WP_L
BUG=chrome-os-partner:49959 BRANCH=none TEST=manual On the Cr50 console, use the "wp" command to get/set the desired state. On the EC console, use "gpioget wp_l" to watch it change. Change-Id: I5978e6116ad0a07a7a61a8356dc1daf79e2397d0 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/373618 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
f729672b66
commit
82e4ac67ac
@@ -49,6 +49,7 @@ board-y += tpm2/rsa.o
|
||||
board-y += tpm2/stubs.o
|
||||
board-y += tpm2/trng.o
|
||||
board-y += tpm2/upgrade.o
|
||||
board-y += wp.o
|
||||
|
||||
# Build and link with an external library
|
||||
EXTLIB := $(realpath ../../third_party/tpm2)
|
||||
|
||||
32
board/cr50/wp.c
Normal file
32
board/cr50/wp.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright 2016 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
#include "registers.h"
|
||||
|
||||
static int command_wp(int argc, char **argv)
|
||||
{
|
||||
int val;
|
||||
|
||||
if (argc > 1) {
|
||||
if (!parse_bool(argv[1], &val))
|
||||
return EC_ERROR_PARAM1;
|
||||
|
||||
/* Invert, because active low */
|
||||
GREG32(RBOX, EC_WP_L) = !val;
|
||||
}
|
||||
|
||||
/* Invert, because active low */
|
||||
val = !GREG32(RBOX, EC_WP_L);
|
||||
|
||||
ccprintf("Flash WP is %s\n", val ? "enabled" : "disabled");
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
DECLARE_CONSOLE_COMMAND(wp, command_wp,
|
||||
"[bool]",
|
||||
"Get/set the flash HW write-protect signal",
|
||||
NULL);
|
||||
Reference in New Issue
Block a user