summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2018-02-08 14:50:50 -0800
committerDaisuke Nojiri <dnojiri@chromium.org>2018-02-19 10:33:13 -0800
commit9bd027722a06058c44a79370caf957b0763a73bd (patch)
tree69d2e58c46af774fd30c683e3c06f7829d7aecd7
parente1fee13ac6954a8528e5946210e313a2e1d6c15e (diff)
downloadchrome-ec-9bd027722a06058c44a79370caf957b0763a73bd.tar.gz
npcx: set eSPI speed to max supported by hardware
the npcx7 can only run eSPI at (up to) 50MHz while the npcx5 can go up to 66MHz. so, set the max speed to whatever the hardware can actually do. the bit pattern for 66MHz is "reserved" on the npcx7, so let's not even define it in the npcx7 case. BUG=b:72838699, b:71859563 BRANCH=none TEST="make buildall" passes; boots on meowth Change-Id: I428caf72a41fe58008df4624c475dafadca4a0bc Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/910321 Commit-Ready: caveh jalali <caveh@chromium.org> Tested-by: caveh jalali <caveh@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--chip/npcx/espi.c5
-rw-r--r--chip/npcx/registers.h10
2 files changed, 12 insertions, 3 deletions
diff --git a/chip/npcx/espi.c b/chip/npcx/espi.c
index ce8fcd9b2b..ae3e5fe735 100644
--- a/chip/npcx/espi.c
+++ b/chip/npcx/espi.c
@@ -610,9 +610,9 @@ void espi_init(void)
SET_FIELD(NPCX_ESPICFG, NPCX_ESPICFG_IOMODE_FILED,
NPCX_ESPI_IO_MODE_ALL);
- /* Max freq 66 MHz of eSPI */
+ /* Set eSPI speed to max supported */
SET_FIELD(NPCX_ESPICFG, NPCX_ESPICFG_MAXFREQ_FILED,
- NPCX_ESPI_MAXFREQ_66);
+ NPCX_ESPI_MAXFREQ_MAX);
/* Configure Master-to-Slave Virtual Wire indexes (Inputs) */
for (i = 0; i < ARRAY_SIZE(espi_in_list); i++)
@@ -682,4 +682,3 @@ static int command_espi(int argc, char **argv)
DECLARE_CONSOLE_COMMAND(espi, command_espi,
"cfg/vms/vsm/en/dis [channel]",
"eSPI configurations");
-
diff --git a/chip/npcx/registers.h b/chip/npcx/registers.h
index 855adfb32d..d451eb04c9 100644
--- a/chip/npcx/registers.h
+++ b/chip/npcx/registers.h
@@ -1666,10 +1666,20 @@ enum {
NPCX_ESPI_MAXFREQ_25 = 1,
NPCX_ESPI_MAXFREQ_33 = 2,
NPCX_ESPI_MAXFREQ_50 = 3,
+#if defined(CHIP_FAMILY_NPCX5)
NPCX_ESPI_MAXFREQ_66 = 4,
+#endif
NPCX_ESPI_MAXFREQ_NOOE = 0xFF
};
+#if defined(CHIP_FAMILY_NPCX5)
+#define NPCX_ESPI_MAXFREQ_MAX NPCX_ESPI_MAXFREQ_66
+#elif defined(CHIP_FAMILY_NPCX7)
+#define NPCX_ESPI_MAXFREQ_MAX NPCX_ESPI_MAXFREQ_50
+#else
+#error "Please define NPCX_ESPI_MAXFREQ_MAX for your chip."
+#endif
+
/* VW types */
enum {
ESPI_VW_TYPE_INT_EV, /* Interrupt event */