nyan/rush/veyron: Align ChromeOS GPIOs to new model
This CL makes slight changes to the ChromeOS-specific GPIO definitions of Tegra and Rockchip boards to prepare them for new features in depthcharge. It adds descriptions for the EC in RW and reset GPIOs, changes the value Tegra writes into the (previously unused) 'port' field to describe the complete GPIO information, and removes code to sample some GPIOs that don't need to be sampled at coreboot time (to help depthcharge detect errors and avoid using a stale value for something that should always represent the current state). BRANCH=None BUG=None TEST=None (tested together with depthcharge patches) Change-Id: I36bb16c8d931f862bf12a5b862b10cf18d738ddd Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231222 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
c99456bf42
commit
df295d0432
9 changed files with 158 additions and 31 deletions
|
|
@ -30,7 +30,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_R1_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
|
|
@ -46,16 +46,16 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_R4_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R4));
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO_Q0_INDEX;
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(Q0));
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -68,6 +68,22 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = GPIO(U4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_R1_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
|
|
@ -46,16 +46,16 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_R4_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R4));
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO_Q0_INDEX;
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(Q0));
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -68,6 +68,22 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = GPIO(U4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_R1_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
|
|
@ -46,16 +46,16 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_R4_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R4));
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO_Q0_INDEX;
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(Q0));
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -68,6 +68,22 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = GPIO(U4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = GPIO_R1_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R1);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO(R1));
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
|
|
@ -46,16 +46,16 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
count++;
|
||||
|
||||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_R4_INDEX;
|
||||
gpios->gpios[count].port = GPIO(R4);
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = 1;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power: active low */
|
||||
gpios->gpios[count].port = GPIO_Q0_INDEX;
|
||||
gpios->gpios[count].port = GPIO(Q0);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = 1;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -68,6 +68,14 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = GPIO(I5);
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
int count = 0;
|
||||
|
||||
/* Write Protect: active low */
|
||||
gpios->gpios[count].port = WRITE_PROTECT_L_INDEX;
|
||||
gpios->gpios[count].port = WRITE_PROTECT_L;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(WRITE_PROTECT_L);
|
||||
strncpy((char *)gpios->gpios[count].name, "write protect",
|
||||
|
|
@ -58,9 +58,9 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
/* TODO(adurbin): add lid switch */
|
||||
|
||||
/* Power: active low / high depending on board id */
|
||||
gpios->gpios[count].port = POWER_BUTTON_INDEX;
|
||||
gpios->gpios[count].port = POWER_BUTTON;
|
||||
gpios->gpios[count].polarity = get_pwr_btn_polarity();
|
||||
gpios->gpios[count].value = gpio_get(POWER_BUTTON);
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -73,6 +73,22 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: active high */
|
||||
gpios->gpios[count].port = EC_IN_RW;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: active low (output) */
|
||||
gpios->gpios[count].port = AP_SYS_RESET_L;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ enum {
|
|||
/* Write Protect */
|
||||
SPI_1V8_WP_L = GPIO(R1),
|
||||
WRITE_PROTECT_L = SPI_1V8_WP_L,
|
||||
WRITE_PROTECT_L_INDEX = GPIO_R1_INDEX,
|
||||
/* Power button - Depending on board id, maybe active high / low */
|
||||
BTN_AP_PWR = GPIO(Q0),
|
||||
POWER_BUTTON = BTN_AP_PWR,
|
||||
POWER_BUTTON_INDEX = GPIO_Q0_INDEX,
|
||||
/* EC in RW signal */
|
||||
EC_IN_RW = GPIO(U4),
|
||||
|
||||
/* Panel related GPIOs */
|
||||
LCD_EN = GPIO(H5),
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@
|
|||
#include <string.h>
|
||||
#include <vendorcode/google/chromeos/chromeos.h>
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#define GPIO_WP GPIO(7, A, 6)
|
||||
#define GPIO_LID GPIO(0, A, 6)
|
||||
#define GPIO_POWER GPIO(0, A, 5)
|
||||
#define GPIO_RECOVERY GPIO(0, B, 1)
|
||||
#define GPIO_ECINRW GPIO(0, A, 7)
|
||||
|
||||
void setup_chromeos_gpios(void)
|
||||
{
|
||||
|
|
@ -61,14 +64,14 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_LID.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_LID);
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power:GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_POWER);
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -81,6 +84,22 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_ECINRW.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@
|
|||
#include <string.h>
|
||||
#include <vendorcode/google/chromeos/chromeos.h>
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#define GPIO_WP GPIO(7, A, 6)
|
||||
#define GPIO_LID GPIO(0, A, 6)
|
||||
#define GPIO_POWER GPIO(0, A, 5)
|
||||
#define GPIO_RECOVERY GPIO(0, B, 1)
|
||||
#define GPIO_ECINRW GPIO(0, A, 7)
|
||||
|
||||
void setup_chromeos_gpios(void)
|
||||
{
|
||||
|
|
@ -61,14 +64,14 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_LID.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_LID);
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Power:GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_LOW;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_POWER);
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -81,6 +84,22 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_ECINRW.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#define GPIO_LID (board_id() > 0 ? GPIO(0, A, 6) : GPIO(7, B, 5))
|
||||
#define GPIO_POWER GPIO(0, A, 5)
|
||||
#define GPIO_RECOVERY GPIO(0, B, 1)
|
||||
#define GPIO_ECINRW GPIO(0, A, 7)
|
||||
|
||||
void setup_chromeos_gpios(void)
|
||||
{
|
||||
|
|
@ -63,7 +64,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
/* Lid: active high */
|
||||
gpios->gpios[count].port = GPIO_LID.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_LID);
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
|
|
@ -71,7 +72,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
gpios->gpios[count].port = GPIO_POWER.raw;
|
||||
gpios->gpios[count].polarity = board_id() > 1 ? ACTIVE_LOW :
|
||||
ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = gpio_get(GPIO_POWER);
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "power",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
|
@ -84,6 +85,22 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
|||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* EC in RW: GPIO active high */
|
||||
gpios->gpios[count].port = GPIO_ECINRW.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "EC in RW",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
/* Reset: GPIO active high (output) */
|
||||
gpios->gpios[count].port = GPIO_RESET.raw;
|
||||
gpios->gpios[count].polarity = ACTIVE_HIGH;
|
||||
gpios->gpios[count].value = -1;
|
||||
strncpy((char *)gpios->gpios[count].name, "reset",
|
||||
GPIO_MAX_NAME_LENGTH);
|
||||
count++;
|
||||
|
||||
gpios->size = sizeof(*gpios) + (count * sizeof(struct lb_gpio));
|
||||
gpios->count = count;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue