summaryrefslogtreecommitdiff
path: root/common/spi_flash_reg.c
diff options
context:
space:
mode:
authorJonathan Brandmeyer <jbrandmeyer@chromium.org>2018-07-30 13:16:46 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-07-31 16:37:04 -0700
commit160748e02929a4fc2142b84dcd91031690420b15 (patch)
tree211476ba7044985a918123f4b47c3caa23573f9d /common/spi_flash_reg.c
parent9b4909334c5b2531e9dd08d81ca00f51ddd1a906 (diff)
downloadchrome-ec-160748e02929a4fc2142b84dcd91031690420b15.tar.gz
careena: Correct baseboard IMU orientation.
The Careena baseboard IMU principle axes are rotated relative to the Grunt reference design for manufacturability. Also, refactor common/spi_flash_reg.c to avoid a name collision with axis definitions in math_util. BRANCH=none BUG=b:111983307 TEST=make -j buldall; Observe `accelread 1` output with the base in orientations: flat, perturbed by rotation about +y, and perturbed by rotation about +x. Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: Ib85d657ef47a89aaa63134b2bdf43920caf6c06e Reviewed-on: https://chromium-review.googlesource.com/1155628 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common/spi_flash_reg.c')
-rw-r--r--common/spi_flash_reg.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/common/spi_flash_reg.c b/common/spi_flash_reg.c
index 569bbd5072..3cee0f3bd4 100644
--- a/common/spi_flash_reg.c
+++ b/common/spi_flash_reg.c
@@ -14,7 +14,7 @@
enum bit_state {
OFF = 0,
ON = 1,
- X = -1, /* Don't care */
+ IGN = -1, /* Don't care / Ignore */
};
struct protect_range {
@@ -26,10 +26,10 @@ struct protect_range {
uint32_t protect_len;
};
-/* Compare macro for (x =? b) for 'X' comparison */
-#define COMPARE_BIT(a, b) ((a) != X && (a) != !!(b))
-/* Assignment macro where 'X' = 0 */
-#define GET_BIT(a) ((a) == X ? 0 : (a))
+/* Compare macro for (x =? b) for 'IGN' comparison */
+#define COMPARE_BIT(a, b) ((a) != IGN && (a) != !!(b))
+/* Assignment macro where 'IGN' = 0 */
+#define GET_BIT(a) ((a) == IGN ? 0 : (a))
/*
* Define flags and protect table for each SPI ROM part. It's not necessary
@@ -39,9 +39,9 @@ struct protect_range {
*/
#if defined(CONFIG_SPI_FLASH_W25X40) || defined(CONFIG_SPI_FLASH_GD25Q41B)
static const struct protect_range spi_flash_protect_ranges[] = {
- { X, X, X, { 0, 0, 0 }, 0, 0 }, /* No protection */
- { X, X, 1, { 0, 1, 1 }, 0, 0x40000 }, /* Lower 1/2 */
- { X, X, 1, { 0, 1, 0 }, 0, 0x20000 }, /* Lower 1/4 */
+ { IGN, IGN, IGN, { 0, 0, 0 }, 0, 0 }, /* No protection */
+ { IGN, IGN, 1, { 0, 1, 1 }, 0, 0x40000 }, /* Lower 1/2 */
+ { IGN, IGN, 1, { 0, 1, 0 }, 0, 0x20000 }, /* Lower 1/4 */
};
#elif defined(CONFIG_SPI_FLASH_W25Q40) || defined(CONFIG_SPI_FLASH_GD25LQ40)
@@ -49,17 +49,17 @@ static const struct protect_range spi_flash_protect_ranges[] = {
/* For GD25LQ40, BP3 and BP4 have same meaning as TB and SEC */
static const struct protect_range spi_flash_protect_ranges[] = {
/* CMP = 0 */
- { 0, X, X, { 0, 0, 0 }, 0, 0 }, /* No protection */
+ { 0, IGN, IGN, { 0, 0, 0 }, 0, 0 }, /* No protection */
{ 0, 0, 1, { 0, 1, 0 }, 0, 0x20000 }, /* Lower 1/4 */
{ 0, 0, 1, { 0, 1, 1 }, 0, 0x40000 }, /* Lower 1/2 */
/* CMP = 1 */
{ 1, 0, 0, { 0, 1, 1 }, 0, 0x40000 }, /* Lower 1/2 */
- { 1, 0, X, { 1, X, X }, 0, 0 }, /* None (W25Q40EW only) */
+ { 1, 0, IGN, { 1, IGN, IGN }, 0, 0 }, /* None (W25Q40EW only) */
};
#elif defined(CONFIG_SPI_FLASH_W25Q64)
static const struct protect_range spi_flash_protect_ranges[] = {
- { 0, X, X, { 0, 0, 0 }, 0, 0 }, /* No protection */
+ { 0, IGN, IGN, { 0, 0, 0 }, 0, 0 }, /* No protection */
{ 0, 0, 1, { 1, 1, 0 }, 0, 0x400000 }, /* Lower 1/2 */
{ 0, 0, 1, { 1, 0, 1 }, 0, 0x200000 }, /* Lower 1/4 */
};
@@ -67,7 +67,7 @@ static const struct protect_range spi_flash_protect_ranges[] = {
#elif defined(CONFIG_SPI_FLASH_W25Q80)
static const struct protect_range spi_flash_protect_ranges[] = {
/* CMP = 0 */
- { 0, X, X, { 0, 0, 0 }, 0, 0 }, /* No protection */
+ { 0, IGN, IGN, { 0, 0, 0 }, 0, 0 }, /* No protection */
{ 0, 0, 1, { 0, 1, 0 }, 0, 0x20000 }, /* Lower 1/8 */
{ 0, 0, 1, { 0, 1, 1 }, 0, 0x40000 }, /* Lower 1/4 */
{ 0, 0, 1, { 1, 0, 0 }, 0, 0x80000 }, /* Lower 1/2 */
@@ -75,7 +75,7 @@ static const struct protect_range spi_flash_protect_ranges[] = {
#elif defined(CONFIG_SPI_FLASH_W25Q128)
static const struct protect_range spi_flash_protect_ranges[] = {
/* CMP = 0 */
- { 0, X, X, { 0, 0, 0 }, 0, 0 }, /* No protection */
+ { 0, IGN, IGN, { 0, 0, 0 }, 0, 0 }, /* No protection */
{ 0, 0, 1, { 1, 0, 0 }, 0, 0x20000 }, /* Lower 1/8 */
{ 0, 0, 1, { 1, 0, 1 }, 0, 0x40000 }, /* Lower 1/4 */
{ 0, 0, 1, { 1, 1, 0 }, 0, 0x80000 }, /* Lower 1/2 */